-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.js
More file actions
42 lines (37 loc) · 1.07 KB
/
Copy patherrors.js
File metadata and controls
42 lines (37 loc) · 1.07 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
class MentorAlreadyExistsError extends Error {
constructor(message = 'Conflict') {
super(message);
this.name = 'MentorAlreadyExistsError';
this.status = 409;
}
}
class DataRequiresElevatedRoleError extends Error {
constructor(message = 'Data requires elevated role') {
super(message);
this.name = 'DataRequiresElevatedRoleError';
this.status = 403;
}
}
class UserDoesNotExistError extends Error {
constructor(message = 'User does not exist') {
super(message);
this.name = 'UserDoesNotExistError';
this.status = 404;
}
}
class MentorDoesNotExistError extends Error {
constructor(message = 'Mentor does not exist') {
super(message);
this.name = 'MentorDoesNotExistError';
this.status = 404;
}
}
class ActionNotAllowedError extends Error {
constructor(message = 'Action not allowed') {
super(message);
this.name = 'ActionNotAllowedError';
this.status = 403;
}
}
module.exports = { MentorAlreadyExistsError, DataRequiresElevatedRoleError,
UserDoesNotExistError, MentorDoesNotExistError, ActionNotAllowedError };