-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patherrors.js
More file actions
38 lines (33 loc) · 892 Bytes
/
errors.js
File metadata and controls
38 lines (33 loc) · 892 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
36
37
38
function CommandCancelledError() {
this.name = "CommandCancelledError";
this.message = "User cancelled";
this.stack = new Error().stack;
}
function TerminalOfflineError() {
this.name = "TerminalOfflineError";
this.message = "Terminal is offline";
this.stack = new Error().stack;
}
function TerminalInUseError() {
this.name = "TerminalInUseError";
this.message = "Terminal is in use";
this.stack = new Error().stack;
}
function TerminalGeneralError() {
this.name = "TerminalGeneralError";
this.message = "Something went wrong";
this.stack = new Error().stack;
}
CommandCancelledError.prototype = new Error();
module.exports = function errorTypeForCode(code) {
if (code === 8) {
return CommandCancelledError;
}
if (code === 7) {
return TerminalInUseError;
}
if (code === 6) {
return TerminalOfflineError;
}
return TerminalGeneralError;
};