You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide ability to handle uncaught exceptions gracefully. #290
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.
Reacted by Shinji Yamada, Justin Merz, Xinyu Chen, Andrew, Ye HE, Daksh, tjhiggins, 微语, Mike Kobit, Theo Gravity, Junghoon Noh and 8 more
This would be a nice feature.
We are wrapping all handlers to catch these scenarios to day and it’s fair
to say that it would be a lot easier to have it provided by the lib.
søn. 22. apr. 2018 kl. 04.56 skrev Jamie Talbot <notifications@github.com>:
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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#290>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGkBnqmQ8B9DX3YVL62-u3HYfKr1Xawfks5tq_FogaJpZM4TetER>
.
Activity
Crevil commentedon Apr 22, 2018
nicolasnoble commentedon Apr 22, 2018
We've touched the subject of having generic wrapper mechanism, but we're not decided yet.
Lihemen commentedon Aug 23, 2023
Any conclusion on this or workarounds in newer releases?
The inability to have a global uncaughtErrorHandler makes the server so brittle