Skip to content

Log unhandled errors that occur upon startup or handling HTTP requests #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2018

Conversation

phillipj
Copy link
Member

@phillipj phillipj commented Jun 9, 2018

Whenever unhandled errors are raised, it's especially important for us to get some hints of what happened. In a perfect world these kinds of errors shouldn't happen, but ofcourse they do for time to time..

The last time we had this kinds of error, there were no errors visible in the logs, other than seeing that the bot process seemed to restart more than usual.

While working in these changes, I found that the default unhandled error handler in express.js, writes the error to stdout, not into the log log files we've write through via bunyan.

With these changes in place we'll get something like this in the logs:

19:16:26.303Z FATAL bot: Unchaught exception, terminating bot process immediately
    ReferenceError: invokingNoneExistentFunction is not defined
        at Promise.resolve.then (/github-bot/app.js:47:31)
        at process._tickCallback (internal/process/next_tick.js:109:7)
        at Module.runMain (module.js:613:11)
        at run (bootstrap_node.js:387:7)
        at startup (bootstrap_node.js:153:9)
        at bootstrap_node.js:500:3

Refs #174

/cc @nodejs/github-bot

Whenever unhandled errors are raised, it's especially important for us
to get some hints of what happened. In a perfect world these kinds of
errors shouldn't happen, but ofcourse they do for time to time..

The last time we had this kinds of error, there were no errors visible
in the logs, other than seeing that the bot process seemed to restart
more than usual.

While working in these changes, I found that the default unhandled
error handler in express.js, writes the error to stdout, not into the
log log files we've write through via bunyan.

With these changes in place we'll get something like this in the logs:

```
19:16:26.303Z FATAL bot: Unchaught exception, terminating bot process immediately
    ReferenceError: invokingNoneExistentFunction is not defined
        at Promise.resolve.then (/github-bot/app.js:47:31)
        at process._tickCallback (internal/process/next_tick.js:109:7)
        at Module.runMain (module.js:613:11)
        at run (bootstrap_node.js:387:7)
        at startup (bootstrap_node.js:153:9)
        at bootstrap_node.js:500:3
```

Refs nodejs#174
maclover7

This comment was marked as off-topic.

@phillipj phillipj merged commit 9825cef into nodejs:master Jun 9, 2018
@phillipj phillipj deleted the log-unhandled-errors branch June 9, 2018 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants