@@ -93,9 +93,11 @@ function loadEpidata(
9393 }
9494 points . push ( new EpiPoint ( date , row [ col ] as number ) ) ;
9595 }
96- // overwrite default column name if there's an overwrite in columnRenamings
97- const title = colRenamings . has ( col ) ? colRenamings . get ( col ) : col ;
98- datasets . push ( new DataSet ( points , title , params ) ) ;
96+ if ( points . length > 0 ) {
97+ // overwrite default column name if there's an overwrite in columnRenamings
98+ const title = colRenamings . has ( col ) ? colRenamings . get ( col ) : col ;
99+ datasets . push ( new DataSet ( points , title , params ) ) ;
100+ }
99101 }
100102 return new DataGroup ( name , datasets ) ;
101103}
@@ -140,7 +142,18 @@ export function loadDataSet(
140142 url . searchParams . set ( 'format' , 'json' ) ;
141143 return fetchImpl < Record < string , unknown > [ ] > ( url )
142144 . then ( ( res ) => {
143- return loadEpidata ( title , res , columns , columnRenamings , { _endpoint : endpoint , ...params } ) ;
145+ const data = loadEpidata ( title , res , columns , columnRenamings , { _endpoint : endpoint , ...params } ) ;
146+ if ( data . datasets . length == 0 ) {
147+ return UIkit . modal
148+ . alert (
149+ `
150+ <div class="uk-alert uk-alert-error">
151+ <a href="${ url . href } ">API Link</a> returned no data.
152+ </div>` ,
153+ )
154+ . then ( ( ) => null ) ;
155+ }
156+ return data ;
144157 } )
145158 . catch ( ( error ) => {
146159 console . warn ( 'failed fetching data' , error ) ;
0 commit comments