From 054dab5c362fec1e1e970d8053381412cf88b379 Mon Sep 17 00:00:00 2001 From: Romke van der Meulen Date: Fri, 21 Sep 2018 01:14:40 +0200 Subject: [PATCH] fix(waitFor): reject with Error rather than string (#84) * fix(waitFor): reject with Error rather than string When used in combination with async / await, the value that the promise is rejected with may be thrown, and throwing a string literal rather than an Error may cause warnings in some browsers. * fix: revert changes to dist folder These changes will be generated during the build. --- src/wait.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wait.ts b/src/wait.ts index 1f72a6e..b2ba116 100644 --- a/src/wait.ts +++ b/src/wait.ts @@ -38,7 +38,7 @@ export function waitFor(getter: () => T, options: { new Promise( (_, rj) => setTimeout(() => { timedOut = true; - rj(options.present ? 'Element not found' : 'Element not removed'); + rj(new Error(options.present ? 'Element not found' : 'Element not removed')); }, options.timeout) ), wait()