Skip to content

Commit 078db34

Browse files
Tweak error messages
1 parent dcb3259 commit 078db34

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('AbstractExecutionService', () => {
8181
endowments: ['console'],
8282
}),
8383
).rejects.toThrow(
84-
`The executor for npm:@metamask/example-snap couldn't start initialization.`,
84+
`The executor for npm:@metamask/example-snap couldn't start initialization. The offscreen document may not exist.`,
8585
);
8686
});
8787

@@ -105,7 +105,7 @@ describe('AbstractExecutionService', () => {
105105
endowments: ['console'],
106106
}),
107107
).rejects.toThrow(
108-
'The executor for npm:@metamask/example-snap failed to initialize.',
108+
'The executor for npm:@metamask/example-snap failed to initialize. The iframe/webview/worker failed to load.',
109109
);
110110
});
111111

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,14 @@ export abstract class AbstractExecutionService<WorkerType>
265265

266266
const status = this.#status.get(snapId);
267267
if (status === 'created') {
268+
// Currently this error can only be thrown by OffscreenExecutionService.
268269
throw new Error(
269-
`The executor for ${snapId} couldn't start initialization.`,
270+
`The executor for ${snapId} couldn't start initialization. The offscreen document may not exist.`,
270271
);
271272
}
272-
273-
if (status === 'initializing') {
274-
throw new Error(`The executor for ${snapId} failed to initialize.`);
275-
}
276-
277-
throw new Error(`The executor for ${snapId} was unreachable.`);
273+
throw new Error(
274+
`The executor for ${snapId} failed to initialize. The iframe/webview/worker failed to load.`,
275+
);
278276
}
279277

280278
const { worker, stream: envStream } = result;
@@ -392,7 +390,9 @@ export abstract class AbstractExecutionService<WorkerType>
392390
);
393391

394392
if (pingResult === hasTimedOut) {
395-
throw new Error(`The executor for ${snapId} was unreachable.`);
393+
throw new Error(
394+
`The executor for ${snapId} was unreachable. The executor did not respond in time.`,
395+
);
396396
}
397397
}
398398

0 commit comments

Comments
 (0)