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()