fac-13 / PaGiToNi

https://pagitoni-news.herokuapp.com/
1 stars 2 forks source link

Error handling - show on page to notify user #59

Open helenzhou6 opened 6 years ago

helenzhou6 commented 6 years ago

Great error handling and use of error-first callbacks!

It looks like in your handler.js file you are sending back an error message and appropriate status code:

        res.writeHead(500, { "Content-Type": "application/json" });
        res.end(JSON.stringify({ error : "Can't get the latest articles" }));

Here

But in the front end the error message is not being used and displayed to the user: https://github.com/fac-13/PaGiToNi/blob/7a5fea2756152ef2845ba5370cc0cee026ce7f4f/public/index.js#L44-L46

I would somehow try and display the error (such as there has been a server error) to the user rather than console.log