1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | class UnifileError extends Error {
|
7 | static get ENOTSUP() { return 'ENOTSUP'; }
|
8 | static get EISDIR() { return 'EISDIR'; }
|
9 | static get EACCES() { return 'EACCES'; }
|
10 | static get EINVAL() { return 'EINVAL'; }
|
11 | static get ENOENT() { return 'ENOENT'; }
|
12 | static get EIO() { return 'EIO'; }
|
13 |
|
14 | constructor(code, message, ...params) {
|
15 | super(message, ...params);
|
16 | this.name = 'UnifileError';
|
17 | this.code = code;
|
18 |
|
19 |
|
20 | Object.defineProperty(this, 'message', {
|
21 | value: message,
|
22 | writable: false,
|
23 | enumerable: true,
|
24 | configurable: true
|
25 | });
|
26 | }
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | class BatchError extends UnifileError {
|
34 | constructor(code, message, ...args) {
|
35 | super(code, message, ...args);
|
36 | this.name = 'BatchError';
|
37 | }
|
38 | }
|
39 |
|
40 | module.exports = {
|
41 | UnifileError: UnifileError,
|
42 | BatchError: BatchError
|
43 | };
|
44 |
|