forked from Adam-Thometz/OpenAI-Stream-Experiment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.js
More file actions
35 lines (31 loc) · 783 Bytes
/
errors.js
File metadata and controls
35 lines (31 loc) · 783 Bytes
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
export class GeneralError extends Error {
constructor(message, status) {
super();
this.message = message;
this.status = status;
};
};
// 400 Bad Request error
export class BadRequestError extends GeneralError {
constructor(message = "400 - Bad Request") {
super(message, 400);
};
};
// 401 Unauthorized error
export class UnauthorizedError extends GeneralError {
constructor(message = "401 - Unauthorized") {
super(message, 401);
};
};
// 403 Forbidden error
export class ForbiddenError extends GeneralError {
constructor(message = "403 - Forbidden request") {
super(message, 403);
};
};
// 404 Forbidden error
export class NotFoundError extends GeneralError {
constructor(message = "404 - Not found!") {
super(message, 404);
};
};