fac-u / take-me-away

Travel
https://fac-u.github.io/take-me-away/
1 stars 3 forks source link

Error handling #52

Closed otajor closed 7 years ago

otajor commented 7 years ago

You're passing your errors back to your callbacks nicely but you don't seem to be doing anything with them? Functions like processWeather take an error parameter but then just ignore it.

Also when you're passing your error back here you might want to pass something useful back to the callback in the case of a bad status code.

if (err || response.statusCode !== 200) {
  cb(err);
 } else {
  ...

If there is no error but the statusCode is something other than 200, the callback will just be passed undefined as an error, which is falsy - so the callback would think there was no error.

stevehopkinson commented 7 years ago

Fixed now. Ta!