diff options
Diffstat (limited to 'remote/test/puppeteer/packages/puppeteer-core/src/common/Errors.ts')
-rw-r--r-- | remote/test/puppeteer/packages/puppeteer-core/src/common/Errors.ts | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/remote/test/puppeteer/packages/puppeteer-core/src/common/Errors.ts b/remote/test/puppeteer/packages/puppeteer-core/src/common/Errors.ts index 8225d64f07..4d0a43ea33 100644 --- a/remote/test/puppeteer/packages/puppeteer-core/src/common/Errors.ts +++ b/remote/test/puppeteer/packages/puppeteer-core/src/common/Errors.ts @@ -5,11 +5,11 @@ */ /** - * @deprecated Do not use. + * The base class for all Puppeteer-specific errors * * @public */ -export class CustomError extends Error { +export class PuppeteerError extends Error { /** * @internal */ @@ -36,14 +36,14 @@ export class CustomError extends Error { * * @public */ -export class TimeoutError extends CustomError {} +export class TimeoutError extends PuppeteerError {} /** * ProtocolError is emitted whenever there is an error from the protocol. * * @public */ -export class ProtocolError extends CustomError { +export class ProtocolError extends PuppeteerError { #code?: number; #originalMessage = ''; @@ -76,49 +76,9 @@ export class ProtocolError extends CustomError { * * @public */ -export class UnsupportedOperation extends CustomError {} +export class UnsupportedOperation extends PuppeteerError {} /** * @internal */ export class TargetCloseError extends ProtocolError {} - -/** - * @deprecated Do not use. - * - * @public - */ -export interface PuppeteerErrors { - TimeoutError: typeof TimeoutError; - ProtocolError: typeof ProtocolError; -} - -/** - * @deprecated Import error classes directly. - * - * Puppeteer methods might throw errors if they are unable to fulfill a request. - * For example, `page.waitForSelector(selector[, options])` might fail if the - * selector doesn't match any nodes during the given timeframe. - * - * For certain types of errors Puppeteer uses specific error classes. These - * classes are available via `puppeteer.errors`. - * - * @example - * An example of handling a timeout error: - * - * ```ts - * try { - * await page.waitForSelector('.foo'); - * } catch (e) { - * if (e instanceof TimeoutError) { - * // Do something if this is a timeout. - * } - * } - * ``` - * - * @public - */ -export const errors: PuppeteerErrors = Object.freeze({ - TimeoutError, - ProtocolError, -}); |