@@ -111,26 +111,30 @@ export function UnassignedSource() {
111111 STATUS_TO_EXCLUDE_SIMBAD_SEARCH . includes ( data . source . status )
112112 )
113113 return { data : [ ] , queryTimestamp : undefined } ;
114- let matches : SimbadMatch [ ] = [ ] ;
114+ // Any failure here (network error, non-2xx status, or an unexpected response shape) is
115+ // surfaced in the SIMBAD card below rather than shown as an empty match list, which would
116+ // read as "nothing nearby" and could lead a reviewer to wrongly rule out an external match.
115117 const getSimbadHits = await fetch (
116118 SIMBAD_BASE_URL +
117119 '/cone' +
118120 `?ra=${ toSimbadRa ( data . source . ra ) } &dec=${ data . source . dec } &sr=${ UNASSIGNED_BEAM_RADIUS_ARCMIN / 60 } &verb=2&maxrec=10&responseformat=json&order_by=nb_ref&order_dir=desc`
119121 ) ;
120- try {
121- const hitsJson = ( await getSimbadHits . json ( ) ) as SimbadConeResponse ;
122- matches = hitsJson . data . map ( ( row ) => ( {
123- identifier : row [ 1 ] ?? 'SIMBAD object' ,
124- objectType : row [ 4 ] ?? null ,
125- ra : row [ 2 ] ?? null ,
126- dec : row [ 3 ] ?? null ,
127- separationArcmin : row [ 0 ] != null ? row [ 0 ] * 60 : null ,
128- } ) ) ;
129- } catch {
130- console . error (
131- 'An error occurred when querying for nearby SIMBAD sources.'
122+ if ( ! getSimbadHits . ok ) {
123+ throw new Error (
124+ `SIMBAD returned ${ getSimbadHits . status } ${ getSimbadHits . statusText } `
132125 ) ;
133126 }
127+ const hitsJson = ( await getSimbadHits . json ( ) ) as SimbadConeResponse ;
128+ if ( ! Array . isArray ( hitsJson ?. data ) ) {
129+ throw new Error ( 'SIMBAD returned an unexpected response.' ) ;
130+ }
131+ const matches : SimbadMatch [ ] = hitsJson . data . map ( ( row ) => ( {
132+ identifier : row [ 1 ] ?? 'SIMBAD object' ,
133+ objectType : row [ 4 ] ?? null ,
134+ ra : row [ 2 ] ?? null ,
135+ dec : row [ 3 ] ?? null ,
136+ separationArcmin : row [ 0 ] != null ? row [ 0 ] * 60 : null ,
137+ } ) ) ;
134138 return {
135139 // ISO 8601, not a locale-formatted string: this doubles as the `queried_at` sent to the
136140 // server's external_evidence.queried_at (a datetime field) if the reviewer accepts one
@@ -244,10 +248,6 @@ export function UnassignedSource() {
244248 throw new Error ( error . message ) ;
245249 }
246250
247- if ( simbadError ) {
248- throw new Error ( simbadError . message ) ;
249- }
250-
251251 return (
252252 < div className = "unassigned-source-page-container" >
253253 < ConfirmDialog
@@ -423,6 +423,11 @@ export function UnassignedSource() {
423423 >
424424 { isSimbadQueryActive ? (
425425 < p > Loading...</ p >
426+ ) : simbadError ? (
427+ < p className = "small-text" >
428+ The SIMBAD search failed, so potential matches couldn’t be
429+ checked. Reload the page to try again.
430+ </ p >
426431 ) : (
427432 < >
428433 < p className = "small-text" >
0 commit comments