blob: 4d0a43ea33a7adcc442a5346d1a996dae186bc48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/**
* @license
* Copyright 2018 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* The base class for all Puppeteer-specific errors
*
* @public
*/
export class PuppeteerError extends Error {
/**
* @internal
*/
constructor(message?: string) {
super(message);
this.name = this.constructor.name;
}
/**
* @internal
*/
get [Symbol.toStringTag](): string {
return this.constructor.name;
}
}
/**
* TimeoutError is emitted whenever certain operations are terminated due to
* timeout.
*
* @remarks
* Example operations are {@link Page.waitForSelector | page.waitForSelector} or
* {@link PuppeteerNode.launch | puppeteer.launch}.
*
* @public
*/
export class TimeoutError extends PuppeteerError {}
/**
* ProtocolError is emitted whenever there is an error from the protocol.
*
* @public
*/
export class ProtocolError extends PuppeteerError {
#code?: number;
#originalMessage = '';
set code(code: number | undefined) {
this.#code = code;
}
/**
* @readonly
* @public
*/
get code(): number | undefined {
return this.#code;
}
set originalMessage(originalMessage: string) {
this.#originalMessage = originalMessage;
}
/**
* @readonly
* @public
*/
get originalMessage(): string {
return this.#originalMessage;
}
}
/**
* Puppeteer will throw this error if a method is not
* supported by the currently used protocol
*
* @public
*/
export class UnsupportedOperation extends PuppeteerError {}
/**
* @internal
*/
export class TargetCloseError extends ProtocolError {}
|