-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathErrors.ts
More file actions
115 lines (96 loc) · 4.08 KB
/
Copy pathErrors.ts
File metadata and controls
115 lines (96 loc) · 4.08 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import type { HttpResponse, RokuMessages } from './RokuDeploy';
import type * as requestType from 'request';
export class InvalidDeviceResponseCodeError extends Error {
constructor(message: string, public results?: any) {
super(message);
Object.setPrototypeOf(this, InvalidDeviceResponseCodeError.prototype);
}
}
export class UnauthorizedDeviceResponseError extends Error {
constructor(message: string, public results?: any) {
super(message);
Object.setPrototypeOf(this, UnauthorizedDeviceResponseError.prototype);
}
}
export class EcpNetworkAccessModeDisabledError extends Error {
constructor(message: string, public results?: any) {
super(message);
Object.setPrototypeOf(this, EcpNetworkAccessModeDisabledError.prototype);
}
}
export class UnparsableDeviceResponseError extends Error {
constructor(message: string, public results?: any) {
super(message);
Object.setPrototypeOf(this, UnparsableDeviceResponseError.prototype);
}
}
export class FailedDeviceResponseError extends Error {
constructor(message: string, public results?: any) {
super(message);
Object.setPrototypeOf(this, FailedDeviceResponseError.prototype);
}
}
export class UnknownDeviceResponseError extends Error {
constructor(message: string, public results?: any) {
super(message);
Object.setPrototypeOf(this, UnknownDeviceResponseError.prototype);
}
}
export class CompileError extends Error {
constructor(message: string, public results: any, public rokuMessages: RokuMessages) {
super(message);
Object.setPrototypeOf(this, CompileError.prototype);
}
}
export class ConvertError extends Error {
constructor(message: string) {
super(message);
Object.setPrototypeOf(this, ConvertError.prototype);
}
}
export class MissingRequiredOptionError extends Error {
constructor(message: string) {
super(message);
Object.setPrototypeOf(this, MissingRequiredOptionError.prototype);
}
}
export class UnsupportedFirmwareVersionError extends Error {
constructor(message: string) {
super(message);
Object.setPrototypeOf(this, UnsupportedFirmwareVersionError.prototype);
}
}
/**
* This error is thrown when a Roku device refuses to accept connections because it requires the user to check for updates (even if no updates are actually available).
*/
export class UpdateCheckRequiredError extends Error {
static MESSAGE = `Your device needs to check for updates before accepting connections. Please navigate to System Settings and check for updates and then try again.\n\nhttps://support.roku.com/article/208755668.`;
constructor(
public response: HttpResponse,
public requestOptions: requestType.OptionsWithUrl,
public cause?: Error
) {
super();
this.message = UpdateCheckRequiredError.MESSAGE;
Object.setPrototypeOf(this, UpdateCheckRequiredError.prototype);
}
}
export function isUpdateCheckRequiredError(e: any): e is UpdateCheckRequiredError {
return e?.constructor?.name === 'UpdateCheckRequiredError';
}
/**
* This error is thrown when a Roku device ends the connection unexpectedly, causing an 'ECONNRESET' error. Typically this happens when the device needs to check for updates (even if no updates are available), but it can also happen for other reasons.
*/
export class ConnectionResetError extends Error {
static MESSAGE = `The Roku device ended the connection unexpectedly and may need to check for updates before accepting connections. Please navigate to System Settings and check for updates and then try again.\n\nhttps://support.roku.com/article/208755668.`;
constructor(error: Error, requestOptions: requestType.OptionsWithUrl) {
super();
this.message = ConnectionResetError.MESSAGE;
this.cause = error;
Object.setPrototypeOf(this, ConnectionResetError.prototype);
}
public cause?: Error;
}
export function isConnectionResetError(e: any): e is ConnectionResetError {
return e?.constructor?.name === 'ConnectionResetError';
}