feat: introduce puppeteer/Errors (#3056)

This patch adds a new require, `puppeteer/Errors`, that
holds all the Puppeteer-specific error classes.

Currently, the only custom error class we use is `TimeoutError`. We'll
expand in future with `CrashError` and some others.

Fixes #1694.
This commit is contained in:
Andrey Lushnikov
2018-08-09 16:51:12 -07:00
committed by GitHub
parent 231a2be971
commit 204c7ec8c4
21 changed files with 178 additions and 38 deletions

View File

@@ -108,7 +108,12 @@ const DefaultMatchers = {
pass: Math.abs(value - other) < Math.pow(10, -precision),
message
};
}
},
toBeInstanceOf: function(value, other, message) {
message = message || `${value.constructor.name} instanceof ${other.name}`;
return { pass: value instanceof other, message };
},
};
function stringify(value) {