Commit 9825cef
authored
Log unhandled errors that occur upon startup or handling HTTP requests (nodejs#179)
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
/cc @nodejs/github-bot1 parent 8fdb3db commit 9825cef
2 files changed
+15
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
42 | 47 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments