errors icon indicating copy to clipboard operation
errors copied to clipboard

Take in Error object and automatically find message

Open nodesocket opened this issue 8 years ago • 3 comments

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));

nodesocket avatar Mar 28 '16 23:03 nodesocket

Once 5.x lands this will become the default behavior, as all errors created by restify-errors inherit from VError.

DonutEspresso avatar Apr 09 '16 02:04 DonutEspresso

Great, any idea when 5.x will land?

nodesocket avatar Apr 11 '16 02:04 nodesocket

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?

DonutEspresso avatar Sep 01 '16 01:09 DonutEspresso