From 9c96f9156a00d0d46e2a18b03ce00dbcdabf6a40 Mon Sep 17 00:00:00 2001 From: imagio Date: Sat, 31 Dec 2022 10:51:43 -0500 Subject: [PATCH] Add name to WHEN_TIMEOUT error if available --- packages/mobx/src/api/when.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mobx/src/api/when.ts b/packages/mobx/src/api/when.ts index 84c17f6ca..f68002ac2 100644 --- a/packages/mobx/src/api/when.ts +++ b/packages/mobx/src/api/when.ts @@ -35,7 +35,7 @@ export function when(predicate: any, arg1?: any, arg2?: any): any { function _when(predicate: () => boolean, effect: Lambda, opts: IWhenOptions): IReactionDisposer { let timeoutHandle: any if (typeof opts.timeout === "number") { - const error = new Error("WHEN_TIMEOUT") + const error = new Error(`WHEN_TIMEOUT${opts.name ? `: ${opts.name}` : ``}`) timeoutHandle = setTimeout(() => { if (!disposer[$mobx].isDisposed_) { disposer()