Skip to content

Commit 5fb07ea

Browse files
fix: Reduce from error to warning for message when failing to terminate (#3621)
When failing to terminate gracefully we currently log an error, it can be a warning instead since it doesn't prevent the Snap from terminating. Intentionally also removing the logging of `result` which is almost always a symbol that clutters the error message.
1 parent e170a4f commit 5fb07ea

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/snaps-controllers/src/services/AbstractExecutionService.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ObjectMultiplex from '@metamask/object-multiplex';
44
import type { BasePostMessageStream } from '@metamask/post-message-stream';
55
import { JsonRpcError } from '@metamask/rpc-errors';
66
import type { SnapRpcHookArgs } from '@metamask/snaps-utils';
7-
import { SNAP_STREAM_NAMES, logError } from '@metamask/snaps-utils';
7+
import { SNAP_STREAM_NAMES, logError, logWarning } from '@metamask/snaps-utils';
88
import type {
99
Json,
1010
JsonRpcNotification,
@@ -180,12 +180,7 @@ export abstract class AbstractExecutionService<WorkerType>
180180
);
181181

182182
if (result === hasTimedOut || result !== 'OK') {
183-
// We tried to shutdown gracefully but failed. This probably means the Snap is in infinite loop and
184-
// hogging down the whole JS process.
185-
// TODO(ritave): It might be doing weird things such as posting a lot of setTimeouts. Add a test to ensure that this behaviour
186-
// doesn't leak into other workers. Especially important in IframeExecutionEnvironment since they all share the same
187-
// JS process.
188-
logError(`Snap "${snapId}" failed to terminate gracefully.`, result);
183+
logWarning(`Snap "${snapId}" failed to terminate gracefully.`);
189184
}
190185
} catch {
191186
// Ignore

0 commit comments

Comments
 (0)