-
Notifications
You must be signed in to change notification settings - Fork 225
/
Copy patherror.js
37 lines (34 loc) · 1.37 KB
/
error.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
35
36
37
import util from "node:util";
const ERROR_CODES = {
ABORTED: "archive was aborted",
DIRECTORYDIRPATHREQUIRED:
"diretory dirpath argument must be a non-empty string value",
DIRECTORYFUNCTIONINVALIDDATA:
"invalid data returned by directory custom data function",
ENTRYNAMEREQUIRED: "entry name must be a non-empty string value",
FILEFILEPATHREQUIRED:
"file filepath argument must be a non-empty string value",
FINALIZING: "archive already finalizing",
QUEUECLOSED: "queue closed",
NOENDMETHOD: "no suitable finalize/end method defined by module",
DIRECTORYNOTSUPPORTED: "support for directory entries not defined by module",
FORMATSET: "archive format already set",
INPUTSTEAMBUFFERREQUIRED:
"input source must be valid Stream or Buffer instance",
MODULESET: "module already set",
SYMLINKNOTSUPPORTED: "support for symlink entries not defined by module",
SYMLINKFILEPATHREQUIRED:
"symlink filepath argument must be a non-empty string value",
SYMLINKTARGETREQUIRED:
"symlink target argument must be a non-empty string value",
ENTRYNOTSUPPORTED: "entry not supported",
};
function ArchiverError(code, data) {
Error.captureStackTrace(this, this.constructor);
//this.name = this.constructor.name;
this.message = ERROR_CODES[code] || code;
this.code = code;
this.data = data;
}
util.inherits(ArchiverError, Error);
export { ArchiverError };