@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
30 lines (29 loc) • 835 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) {
let {
message
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
message: null
};
let code = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 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