Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 13 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | function APIError(code, message, body) { |
||
2 | this.code = code; |
||
3 | this.message = (message || ''); |
||
4 | this.body = body; |
||
5 | } |
||
6 | |||
7 | Object.setPrototypeOf(APIError.prototype, Error.prototype); |
||
8 | APIError.prototype.name = 'APIError'; |
||
9 | APIError.prototype.toString = function toString() { |
||
10 | return this.message ? this.code + ' - ' + this.message : String(this.code); |
||
11 | }; |
||
12 | |||
13 | export default APIError; |