Skip to content

Commit 786718a

Browse files
fix: Only log error that originally caused the crash (#3569)
The crash logging that we recently added would trigger for any unhandled error, including cancelled requests during a crash. This PR only logs the original crash error.
1 parent 235feed commit 786718a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/snaps-controllers/src/snaps/SnapController.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,11 +3684,15 @@ export class SnapController extends BaseController<
36843684

36853685
const [jsonRpcError, handled] = unwrapError(error);
36863686

3687+
const stopping = runtime.stopPromise !== null || !this.isRunning(snapId);
3688+
36873689
if (!handled) {
3688-
logError(
3689-
`"${snapId}" crashed due to an unhandled error:`,
3690-
jsonRpcError,
3691-
);
3690+
if (!stopping) {
3691+
logError(
3692+
`"${snapId}" crashed due to an unhandled error:`,
3693+
jsonRpcError,
3694+
);
3695+
}
36923696
await this.stopSnap(snapId, SnapStatusEvents.Crash);
36933697
}
36943698

0 commit comments

Comments
 (0)