web: create error from ErrorEvent if none found

This commit is contained in:
Abdullah Atta
2024-03-07 13:25:48 +05:00
parent 92c9f31e01
commit bf62cd93b2

View File

@@ -41,7 +41,9 @@ export default function useDatabase(persistence: "db" | "memory" = "db") {
.catch((e) => showBoundary(e));
function handleError(e: ErrorEvent) {
showBoundary(e.error);
const error = new Error(e.message);
error.stack = `${e.filename}:${e.lineno}:${e.colno}`;
showBoundary(e.error || error);
}
function handleUnhandledRejection(e: PromiseRejectionEvent) {
showBoundary(e.reason);