Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Added error handling #95

Merged
merged 3 commits into from
Nov 12, 2015
Merged

Added error handling #95

merged 3 commits into from
Nov 12, 2015

Conversation

vmaudgalya
Copy link
Contributor

Just added some error handling.

@@ -26,6 +26,7 @@ app.use(bodyParser.urlencoded({extended: true}));

app.get('/api/comments', function(req, res) {
fs.readFile(COMMENTS_FILE, function(err, data) {
if (err) console.log(err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use blocks (with curlies). And perhaps uses console.error. We should perhaps actually handle the error though. Otherwise we might just get another error when we call JSON.parse.

If we're going to say we're handling the error, let's handle them all and not just log.

Personally I don't care terribly - these are only meant to be good enough, not production ready. If you'd like to make this versatile, feel free.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zpao Thank you for the input. I completely agree that it is not a huge deal as it's not meant to be production ready code, and that adding extensive error handling may result in unneeded code bloating. I made some edits based on your suggestions.

@zpao
Copy link
Member

zpao commented Nov 12, 2015

The nuclear option, I like it :) Thanks!

zpao added a commit that referenced this pull request Nov 12, 2015
@zpao zpao merged commit a45fe12 into reactjs:master Nov 12, 2015
@vmaudgalya
Copy link
Contributor Author

@zpao Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants