47 lines
1.7 KiB
Plaintext
47 lines
1.7 KiB
Plaintext
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "getErrorByType", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return getErrorByType;
|
|
}
|
|
});
|
|
const _erroroverlayreducer = require("../error-overlay-reducer");
|
|
const _nodeStackFrames = require("./nodeStackFrames");
|
|
const _stackframe = require("./stack-frame");
|
|
async function getErrorByType(ev) {
|
|
const { id, event } = ev;
|
|
switch(event.type){
|
|
case _erroroverlayreducer.ACTION_UNHANDLED_ERROR:
|
|
case _erroroverlayreducer.ACTION_UNHANDLED_REJECTION:
|
|
{
|
|
const readyRuntimeError = {
|
|
id,
|
|
runtime: true,
|
|
error: event.reason,
|
|
frames: await (0, _stackframe.getOriginalStackFrames)(event.frames, (0, _nodeStackFrames.getErrorSource)(event.reason), event.reason.toString())
|
|
};
|
|
if (event.type === _erroroverlayreducer.ACTION_UNHANDLED_ERROR) {
|
|
readyRuntimeError.componentStackFrames = event.componentStackFrames;
|
|
}
|
|
return readyRuntimeError;
|
|
}
|
|
default:
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const _ = event;
|
|
throw new Error("type system invariant violation");
|
|
}
|
|
|
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
Object.assign(exports.default, exports);
|
|
module.exports = exports.default;
|
|
}
|
|
|
|
//# sourceMappingURL=getErrorByType.js.map |