Provide ability to handle uncaught exceptions gracefully.
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
This is a feature request.
At the moment, if an error is thrown by a handler, the entire process crashes. I would love a facility to define an `uncaughtErrorHandler` so that the server can keep running. This would make servers a lot less brittle, as errors caused in one handler wouldn't cause issues for other requests. For example:
```
function uncaughtErrorHandler(request, err) {
console.log(request, err) // or do something smarter.
return {
code: status.INTERNAL_ERROR,
message: err.message
}
}
const server = new grpc.Server({
uncaughtErrorHandler
})
```
I would expect this to 1) log the error, 2) return the return value of uncaughtErrorHandler to the client.
Contributor guide
Assessment
This issue has not been assessed yet.