Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report crashes in one call to console.error instead of two #2093

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/wasm-node/javascript/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,15 @@ export function start(options?: ClientOptions): Client {
workerOnError(worker, (error) => {
// A worker error should only happen in case of a critical error as the result of a bug
// somewhere. Consequently, nothing is really in place to cleanly report the error.
const errorToString = error.toString();
console.error(
"Smoldot has panicked" +
(workerCurrentTask.name ? (" while executing task `" + workerCurrentTask.name + "`") : "") +
". This is a bug in smoldot. Please open an issue at " +
"https://github.com/paritytech/smoldot/issues with the following message:"
"https://github.com/paritytech/smoldot/issues with the following message:\n" +
errorToString
);
console.error(error);
workerError = new CrashError(error.toString());
workerError = new CrashError(errorToString);

// Reject all promises returned by `addChain`.
for (var pending of pendingConfirmations) {
Expand Down