errors
errors copied to clipboard
Take in Error object and automatically find message
Should be able to just pass an Error
object and automatically fetch the error message from the Error
object.
For example:
return next(new errors.BadRequestError(error));
Instead of (currently):
return next(new errors.BadRequestError(error.message));
Once 5.x lands this will become the default behavior, as all errors created by restify-errors inherit from VError.
Great, any idea when 5.x
will land?
Oops - really sorry for not following up on this thread. I may have been confused, and thought you were asking about restify 4.x.
Are you basically wanting to create a new error, re-using only the error message itself but without creating a cause chain?