darthbatman / billboard-top-100

:chart_with_upwards_trend: Node.js API to retrieve the top songs, albums, and artists from Billboard's charts
MIT License
97 stars 30 forks source link

there is no error if chart is missing for given date #4

Closed adjorno closed 8 years ago

adjorno commented 8 years ago

I am trying to fetch full history of all charts and call your great function repeatedly (and more important synchronously) with shifted date:

const date = new Date('2016-11-19'); // loop const formattedDate = format('yyyy-MM-dd', date); billboard (formattedDate,....) date.setDate(date.getDate() - 7); // end of loop

And everything works great but sometimes there is no chart for the given date for some reason. For now billboard function just silently finishes. It would be great to emit some exception or error callback. There is no info that this date should be skipped and it is ok to try to fetch data for the next week.

darthbatman commented 8 years ago

getChart now calls back with an error when no chart is found.