I would like to know what are the functions that the Error object of nodejs express exposes for use in error handling?
A console.log of an error call new Error('NotFound') is showing only [Error: NotFound].
Is this because the .toString() method is overriden?
How do I find the properties and functions exposed by these objects?
The
Errorobject is actually a native object provided byV8, rather than bynode.jsorexpress.The property that will most likely be of the most use to you is
stack. E.g.,There are other properties available as well, such as
nameandmessage. You can read up on them here. Just be aware that those docs are for Mozilla’s JavaScript engine, so don’t count on anything flagged asNon-standardto work innode.js.