bpms_site/.svn/pristine/cc/cc48ae45c29ec83c50f60b217c0908e99b13cbac.svn-base
2025-11-02 16:38:49 +03:30

31 lines
1.1 KiB
Plaintext

import { ACTION_UNHANDLED_ERROR, ACTION_UNHANDLED_REJECTION } from "../error-overlay-reducer";
import { getErrorSource } from "./nodeStackFrames";
import { getOriginalStackFrames } from "./stack-frame";
export async function getErrorByType(ev) {
const { id, event } = ev;
switch(event.type){
case ACTION_UNHANDLED_ERROR:
case ACTION_UNHANDLED_REJECTION:
{
const readyRuntimeError = {
id,
runtime: true,
error: event.reason,
frames: await getOriginalStackFrames(event.frames, getErrorSource(event.reason), event.reason.toString())
};
if (event.type === 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");
}
//# sourceMappingURL=getErrorByType.js.map