mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
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:
@@ -22,6 +22,7 @@ const Message = require('../Message');
|
||||
const EXCLUDE_CLASSES = new Set([
|
||||
'CSSCoverage',
|
||||
'Connection',
|
||||
'CustomError',
|
||||
'EmulationManager',
|
||||
'FrameManager',
|
||||
'JSCoverage',
|
||||
@@ -35,11 +36,12 @@ const EXCLUDE_CLASSES = new Set([
|
||||
'WaitTask',
|
||||
]);
|
||||
|
||||
const EXCLUDE_METHODS = new Set([
|
||||
const EXCLUDE_PROPERTIES = new Set([
|
||||
'Browser.create',
|
||||
'Headers.fromPayload',
|
||||
'Page.create',
|
||||
'JSHandle.toString',
|
||||
'TimeoutError.name',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -137,7 +139,7 @@ function filterJSDocumentation(jsDocumentation) {
|
||||
// Exclude all constructors by default.
|
||||
if (member.name === 'constructor' && member.type === 'method')
|
||||
return false;
|
||||
return !EXCLUDE_METHODS.has(`${cls.name}.${member.name}`);
|
||||
return !EXCLUDE_PROPERTIES.has(`${cls.name}.${member.name}`);
|
||||
});
|
||||
classes.push(new Documentation.Class(cls.name, members));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user