UnexpectedError: add error repl if failed to parse

This commit is contained in:
thislight 2024-11-04 17:08:30 +08:00
parent a0811ed6c4
commit 832a59031a
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -18,7 +18,16 @@ const UnexpectedError: Component<{ error?: any }> = (props) => {
.join("\n");
return `${err.name}: ${err.message}\n${strackMsg}`;
} catch (reason) {
return `<failed to build the stacktrace of "${err}"...>\n${reason}`;
return `<failed to build the stacktrace of "${err}"...>\n${reason}\n${JSON.stringify(
{
name: err.name,
stack: err.stack,
cause: err.cause,
message: err.message,
},
undefined,
2,
)}`;
}
}