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
How to handle exception with domain module in restify framework? #659
Comments
Hi ioubo, Can you share us a code snippet please? Cheers. |
The following is my code snippet: var server = restify.createServer( { var errorhandler = domain.create(); errorhandler.run(function () {
}); |
If you want to create your own domain, I would suggest wrapping your domain as a middleware, and crete one for each request, just make sure to use it hight enough. But doing that you replicate what restify does already for you. This is my example of rectify server, handling exceptions:
Using the middlewares of your preference:
example of routing
As an error handler:
Finally:
|
Thanks for your reply. As your way, how to get the stack trace of the error? |
If the err is an instance of Error, you can easily log the err.stack.
|
Looks like this issue was answered by epappas. If |
How to get the uncatched exception in restify framework? I try to use server.on('uncaughtException', but it cannot work.
The text was updated successfully, but these errors were encountered: