@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
28 lines (27 loc) • 679 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ERROR_HARMLESS = exports.ERROR_FATAL = void 0;
exports.ErrorHandler = ErrorHandler;
const ERROR_HARMLESS = exports.ERROR_HARMLESS = 100;
const ERROR_FATAL = exports.ERROR_FATAL = 500;
function ErrorHandler(error, {
message
} = {
message: null
}, code = ERROR_HARMLESS) {
let thisError = this && this.err;
if (typeof error === 'object') {
message = error.message;
}
if (thisError) {
thisError = new Error(`${error}\n\n${message}`);
}
if (code === ERROR_FATAL) {
throw thisError;
} else {
console.log(thisError);
}
}
//# sourceMappingURL=error-helper.js.map