diff --git a/packages/snaps-controllers/src/snaps/SnapController.test.tsx b/packages/snaps-controllers/src/snaps/SnapController.test.tsx index cc6226eb97..0f9d9afc86 100644 --- a/packages/snaps-controllers/src/snaps/SnapController.test.tsx +++ b/packages/snaps-controllers/src/snaps/SnapController.test.tsx @@ -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(); diff --git a/packages/snaps-controllers/src/snaps/SnapController.ts b/packages/snaps-controllers/src/snaps/SnapController.ts index a5a23bf1fe..c291a73505 100644 --- a/packages/snaps-controllers/src/snaps/SnapController.ts +++ b/packages/snaps-controllers/src/snaps/SnapController.ts @@ -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);