error-object
v1.0.5
Published
Custom errors
Downloads
2
Readme
Custom errors
Error
var errorObject = require("error-object")
function doSomethingBad() {
throw new errorObject('It went bad!', {
errorCode: 1,
foo: "bar",
obj: {
},
// ...
});
}
try {
doSomethingBad()
} catch (e) {
console.error(err.message);
console.error(err.extra.errorCode);
console.error(err.extra.foo);
console.error(err.extra.obj);
} finally {
}