-
Notifications
You must be signed in to change notification settings - Fork 984
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
Restify does not handle Promise rejection #1853
Comments
Restify handles errors differently that express and doesn't use a middleware. (See the docs for this here) Here is how I handle my errors: ErrorHandler.jsclass ErrorHandler {
constructor(server) {
server.on(`restifyError`, this.defaultErrorHandler);
}
defaultErrorHandler(req, res, err, callback) {
console.error(err);
return callback();
}
} index.jsconst { createServer } = require(`restify`);
const { ErrorHandler } = require(`./ErrorHandler.js`);
const server = createServer();
new ErrorHandler(server); |
@reediculous456 I understand but is not what I asked for... suppose you have this:
then you have this:
none of the following will handle the promise rejection:
so Restify doesn't provide any way to handle Promise Rejection and this is bad |
Restify 8 does not support promises as route handlers. Restify 9 will, support is already integrated on |
@mmarchini do you know of an ETA for v9? |
My application heavily depends on that. Any schedule/ETA? If not, is the current |
I'm trying to handle promise rejection creating a simple middleware, so I did:
so:
but surprising I get:
so
Restify
does not includeError
, and for manage the Promise rejection I should wrap this around each route:this could become a pain, why Restify doesn't support Error in RequestHandler?
The text was updated successfully, but these errors were encountered: