Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ describe('SnapController', () => {
expect(results[0].status).toBe('fulfilled');
expect(results[1].status).toBe('rejected');
expect((results[1] as PromiseRejectedResult).reason.message).toBe(
`${snap.id} failed to respond to the request in time.`,
`${snap.id} was stopped and the request was cancelled. This is likely because the Snap crashed.`,
);

snapController.destroy();
Expand Down
8 changes: 7 additions & 1 deletion packages/snaps-controllers/src/snaps/SnapController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3642,7 +3642,13 @@ export class SnapController extends BaseController<
const result = await withTimeout(handleRpcRequestPromise, timer);

if (result === hasTimedOut) {
throw new Error(`${snapId} failed to respond to the request in time.`);
const stopping =
runtime.stopPromise !== null || !this.isRunning(snapId);
throw new Error(
stopping
? `${snapId} was stopped and the request was cancelled. This is likely because the Snap crashed.`
: `${snapId} failed to respond to the request in time.`,
);
}

await this.#assertSnapRpcResponse(snapId, handlerType, result);
Expand Down
Loading