-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathRTCError.ts
71 lines (58 loc) · 2.13 KB
/
RTCError.ts
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
export default class RTCError extends DOMException implements globalThis.RTCError {
#errorDetail: RTCErrorDetailType;
#receivedAlert: number | null;
#sctpCauseCode: number | null;
#sdpLineNumber: number | null;
#sentAlert: number | null;
constructor(init: globalThis.RTCErrorInit, message?: string) {
super(message, 'OperationError');
if (!init || !init.errorDetail) throw new TypeError('Cannot construct RTCError, errorDetail is required');
if (
[
'data-channel-failure',
'dtls-failure',
'fingerprint-failure',
'hardware-encoder-error',
'hardware-encoder-not-available',
'sctp-failure',
'sdp-syntax-error',
].indexOf(init.errorDetail) === -1
)
throw new TypeError('Cannot construct RTCError, errorDetail is invalid');
this.#errorDetail = init.errorDetail;
this.#receivedAlert = init.receivedAlert ?? null;
this.#sctpCauseCode = init.sctpCauseCode ?? null;
this.#sdpLineNumber = init.sdpLineNumber ?? null;
this.#sentAlert = init.sentAlert ?? null;
}
get errorDetail(): globalThis.RTCErrorDetailType {
return this.#errorDetail;
}
set errorDetail(_value) {
throw new TypeError('Cannot set errorDetail, it is read-only');
}
get receivedAlert(): number | null {
return this.#receivedAlert;
}
set receivedAlert(_value) {
throw new TypeError('Cannot set receivedAlert, it is read-only');
}
get sctpCauseCode(): number | null {
return this.#sctpCauseCode;
}
set sctpCauseCode(_value) {
throw new TypeError('Cannot set sctpCauseCode, it is read-only');
}
get sdpLineNumber(): number | null {
return this.#sdpLineNumber;
}
set sdpLineNumber(_value) {
throw new TypeError('Cannot set sdpLineNumber, it is read-only');
}
get sentAlert(): number | null {
return this.#sentAlert;
}
set sentAlert(_value) {
throw new TypeError('Cannot set sentAlert, it is read-only');
}
}