-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.mjs
More file actions
29 lines (25 loc) · 867 Bytes
/
errors.mjs
File metadata and controls
29 lines (25 loc) · 867 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
class AuthError extends Error {
constructor(message = 'User not logged in') { //Auth errors can, of course, be triggered for other reasons too
super(message);
this.name = 'AuthError';
}
}
class NonexistenceError extends Error {
constructor(message = 'Requested resource does not exist') {
super(message);
this.name = 'NonexistenceError';
}
}
class InvalidDataError extends Error {
constructor(message = 'Data sent either improperly formatted or doesn\'t match expected typing') {
super(message);
this.name = 'InvalidDataError';
}
}
class IllegalOperationError extends Error {
constructor(message = 'Attempted operation not permitted') {
super(message);
this.name = 'IllegalOperationError';
}
}
export default { AuthError, NonexistenceError, InvalidDataError, IllegalOperationError };