-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.js
More file actions
155 lines (132 loc) · 3.46 KB
/
errors.js
File metadata and controls
155 lines (132 loc) · 3.46 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
export function AccessForbiddenError(message) {
var instance = new Error(message);
instance.name = 'AccessForbiddenError';
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
if (Error.captureStackTrace) {
Error.captureStackTrace(instance, AccessForbiddenError);
}
return instance;
}
AccessForbiddenError.prototype = Object.create(Error.prototype, {
constructor: {
value: Error,
enumerable: false,
writable: true,
configurable: true
}
});
if (Object.setPrototypeOf) {
Object.setPrototypeOf(AccessForbiddenError, Error);
} else {
AccessForbiddenError.__proto__ = Error;
}
export function UnauthorizedError(message) {
var instance = new Error(message);
instance.name = 'UnauthorizedError';
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
if (Error.captureStackTrace) {
Error.captureStackTrace(instance, UnauthorizedError);
}
return instance;
}
UnauthorizedError.prototype = Object.create(Error.prototype, {
constructor: {
value: Error,
enumerable: false,
writable: true,
configurable: true
}
});
if (Object.setPrototypeOf) {
Object.setPrototypeOf(UnauthorizedError, Error);
} else {
UnauthorizedError.__proto__ = Error;
}
export function UnknownError(message) {
var instance = new Error(message);
instance.name = 'UnknownError';
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
if (Error.captureStackTrace) {
Error.captureStackTrace(instance, UnknownError);
}
return instance;
}
UnknownError.prototype = Object.create(Error.prototype, {
constructor: {
value: Error,
enumerable: false,
writable: true,
configurable: true
}
});
if (Object.setPrototypeOf) {
Object.setPrototypeOf(UnknownError, Error);
} else {
UnknownError.__proto__ = Error;
}
export function NetworkError(message) {
var instance = new Error(message);
instance.name = 'NetworkError';
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
if (Error.captureStackTrace) {
Error.captureStackTrace(instance, NetworkError);
}
return instance;
}
NetworkError.prototype = Object.create(Error.prototype, {
constructor: {
value: Error,
enumerable: false,
writable: true,
configurable: true
}
});
if (Object.setPrototypeOf) {
Object.setPrototypeOf(NetworkError, Error);
} else {
NetworkError.__proto__ = Error;
}
export function ServerError(message) {
var instance = new Error(message);
instance.name = 'ServerError';
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
if (Error.captureStackTrace) {
Error.captureStackTrace(instance, ServerError);
}
return instance;
}
ServerError.prototype = Object.create(Error.prototype, {
constructor: {
value: Error,
enumerable: false,
writable: true,
configurable: true
}
});
if (Object.setPrototypeOf) {
Object.setPrototypeOf(ServerError, Error);
} else {
ServerError.__proto__ = Error;
}
export function NotFoundError(message) {
var instance = new Error(message);
instance.name = 'NotFoundError';
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
if (Error.captureStackTrace) {
Error.captureStackTrace(instance, NotFoundError);
}
return instance;
}
NotFoundError.prototype = Object.create(Error.prototype, {
constructor: {
value: Error,
enumerable: false,
writable: true,
configurable: true
}
});
if (Object.setPrototypeOf) {
Object.setPrototypeOf(NotFoundError, Error);
} else {
NotFoundError.__proto__ = Error;
}