Skip to content

Commit

Permalink
fix(waitFor): reject with Error rather than string (#84)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
RomkeVdMeulen authored and EisenbergEffect committed Sep 20, 2018
1 parent 0635bad commit 054dab5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wait.ts
Expand Up @@ -38,7 +38,7 @@ export function waitFor<T>(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()
Expand Down

0 comments on commit 054dab5

Please sign in to comment.