-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.js
34 lines (28 loc) · 861 Bytes
/
errors.js
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
const colors = require('chalk');
class BaseError extends Error {
constructor(message) {
message = `
${colors.red(message)}`;
super(message);
this.name = this.constructor.name;
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
}
class PS_PROC_ERROR extends BaseError {
constructor(message = `
Node-PowerShell was unable to start PowerShell.
Please make sure that PowerShell is installed properly on your system, and try again.
https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell`) {
super(message);
}
}
class PS_ARG_MISS_ERROR extends BaseError { }
class PS_ARG_TYPE_ERROR extends BaseError { }
class PS_CMD_FAIL_ERROR extends BaseError { }
module.exports = {
PS_PROC_ERROR,
PS_ARG_MISS_ERROR,
PS_ARG_TYPE_ERROR,
PS_CMD_FAIL_ERROR,
};