@ganintegrity/gan-error
Version:
an extendable ES6 Error with support for HTTP errors
16 lines (12 loc) • 322 B
JavaScript
const addHttpErrors = target => {
const HttpError = require('./HttpError');
Object.keys(HttpError).forEach(key => {
if (!parseInt(key)) {
return;
}
const error = HttpError[key];
target[error.name] = target[key] = error;
});
target.HttpError = HttpError;
};
module.exports = addHttpErrors;