Skip to content

Error handling - show on page to notify user #59

Description

@helenzhou6

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:

PaGiToNi/public/index.js

Lines 44 to 46 in 7a5fea2

if (error) {
console.log(error, "something went wrong");
return;

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

Metadata

Metadata

Assignees

Labels

doneissue fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions