@idlebox/errors 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/autoindex.d.ts +27 -23
- package/lib/autoindex.d.ts.map +1 -1
- package/lib/autoindex.js +41 -25
- package/lib/autoindex.js.map +1 -1
- package/lib/common/base.d.ts +5 -49
- package/lib/common/base.d.ts.map +1 -1
- package/lib/common/base.js +10 -62
- package/lib/common/base.js.map +1 -1
- package/lib/common/human-readable.d.ts +6 -0
- package/lib/common/human-readable.d.ts.map +1 -0
- package/lib/common/human-readable.js +5 -0
- package/lib/common/human-readable.js.map +1 -0
- package/lib/common/not-error.d.ts +12 -0
- package/lib/common/not-error.d.ts.map +1 -0
- package/lib/common/not-error.js +20 -0
- package/lib/common/not-error.js.map +1 -0
- package/lib/common/type-shim.d.ts +5 -0
- package/lib/common/type-shim.d.ts.map +1 -0
- package/lib/common/type-shim.js +3 -0
- package/lib/common/type-shim.js.map +1 -0
- package/lib/common/type.d.ts +13 -0
- package/lib/common/type.d.ts.map +1 -0
- package/lib/common/type.js +2 -0
- package/lib/common/type.js.map +1 -0
- package/lib/common/v8.d.ts +3 -0
- package/lib/common/v8.d.ts.map +1 -0
- package/lib/common/v8.js +4 -0
- package/lib/common/v8.js.map +1 -0
- package/lib/{common → error-types}/application.d.ts +4 -1
- package/lib/error-types/application.d.ts.map +1 -0
- package/lib/{common → error-types}/application.js +3 -1
- package/lib/error-types/application.js.map +1 -0
- package/lib/error-types/dependency.d.ts +24 -0
- package/lib/error-types/dependency.d.ts.map +1 -0
- package/lib/error-types/dependency.js +39 -0
- package/lib/error-types/dependency.js.map +1 -0
- package/lib/error-types/development.d.ts +27 -0
- package/lib/error-types/development.d.ts.map +1 -0
- package/lib/error-types/development.js +50 -0
- package/lib/error-types/development.js.map +1 -0
- package/lib/error-types/nodejs.d.ts.map +1 -0
- package/lib/error-types/nodejs.js.map +1 -0
- package/lib/{common/unhandled-errors.d.ts → error-types/nodejs.unhandled.d.ts} +1 -1
- package/lib/error-types/nodejs.unhandled.d.ts.map +1 -0
- package/lib/{common/unhandled-errors.js → error-types/nodejs.unhandled.js} +1 -1
- package/lib/error-types/nodejs.unhandled.js.map +1 -0
- package/lib/error-types/tools.d.ts +28 -0
- package/lib/error-types/tools.d.ts.map +1 -0
- package/lib/error-types/tools.js +41 -0
- package/lib/error-types/tools.js.map +1 -0
- package/package.json +2 -2
- package/src/autoindex.ts +46 -30
- package/src/common/base.ts +11 -90
- package/src/common/human-readable.ts +8 -0
- package/src/common/not-error.ts +19 -0
- package/src/common/type-shim.ts +7 -0
- package/src/common/type.ts +13 -0
- package/src/common/v8.ts +4 -0
- package/src/{common → error-types}/application.ts +4 -1
- package/src/error-types/dependency.ts +51 -0
- package/src/error-types/development.ts +61 -0
- package/src/error-types/tools.ts +48 -0
- package/lib/common/application.d.ts.map +0 -1
- package/lib/common/application.js.map +0 -1
- package/lib/common/development.d.ts +0 -12
- package/lib/common/development.d.ts.map +0 -1
- package/lib/common/development.js +0 -24
- package/lib/common/development.js.map +0 -1
- package/lib/common/nodejs.d.ts.map +0 -1
- package/lib/common/nodejs.js.map +0 -1
- package/lib/common/unhandled-errors.d.ts.map +0 -1
- package/lib/common/unhandled-errors.js.map +0 -1
- package/src/common/development.ts +0 -24
- /package/lib/{common → error-types}/nodejs.d.ts +0 -0
- /package/lib/{common → error-types}/nodejs.js +0 -0
- /package/src/{common → error-types}/nodejs.ts +0 -0
- /package/src/{common/unhandled-errors.ts → error-types/nodejs.unhandled.ts} +0 -0
package/lib/autoindex.d.ts
CHANGED
|
@@ -10,28 +10,32 @@ export { LinuxErrorCode } from "./codes/linux-error-codes.js";
|
|
|
10
10
|
export { NodeErrorCode } from "./codes/nodejs-re-export.js";
|
|
11
11
|
export { OpenSSLErrorCode } from "./codes/nodejs-re-export.js";
|
|
12
12
|
export { ExitCode } from "./codes/wellknown-exit-codes.js";
|
|
13
|
-
export { Exit } from "./common/application.js";
|
|
14
|
-
export { InterruptError } from "./common/application.js";
|
|
15
|
-
export { UsageError } from "./common/application.js";
|
|
16
|
-
export type { IErrorOptions } from "./common/base.js";
|
|
17
|
-
export { humanReadable } from "./common/base.js";
|
|
18
|
-
export type { IHumanReadable } from "./common/base.js";
|
|
19
|
-
export { isHumanReadableError } from "./common/base.js";
|
|
20
|
-
export { NotError } from "./common/base.js";
|
|
21
13
|
export { ErrorWithCode } from "./common/base.js";
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
14
|
+
export { TypeErrorWithCode } from "./common/base.js";
|
|
15
|
+
export { humanReadable } from "./common/human-readable.js";
|
|
16
|
+
export type { IHumanReadable } from "./common/human-readable.js";
|
|
17
|
+
export { isHumanReadable } from "./common/human-readable.js";
|
|
18
|
+
export { NotError } from "./common/not-error.js";
|
|
19
|
+
export type { IErrorOptions } from "./common/type.js";
|
|
20
|
+
export { Exit } from "./error-types/application.js";
|
|
21
|
+
export { InterruptError } from "./error-types/application.js";
|
|
22
|
+
export { UsageError } from "./error-types/application.js";
|
|
23
|
+
export { DependencyError } from "./error-types/dependency.js";
|
|
24
|
+
export { ChildProcessExitError } from "./error-types/dependency.js";
|
|
25
|
+
export { ProgramError } from "./error-types/development.js";
|
|
26
|
+
export { NotImplementedError } from "./error-types/development.js";
|
|
27
|
+
export { SoftwareDefectError } from "./error-types/development.js";
|
|
28
|
+
export { Assertion } from "./error-types/development.js";
|
|
29
|
+
export { VariableTypeError } from "./error-types/development.js";
|
|
30
|
+
export type { OpenSSLException } from "./error-types/nodejs.js";
|
|
31
|
+
export { isModuleResolutionError } from "./error-types/nodejs.js";
|
|
32
|
+
export { isNotExistsError } from "./error-types/nodejs.js";
|
|
33
|
+
export { isExistsError } from "./error-types/nodejs.js";
|
|
34
|
+
export { isTypeError } from "./error-types/nodejs.js";
|
|
35
|
+
export { isFileTypeError } from "./error-types/nodejs.js";
|
|
36
|
+
export { isNodeError } from "./error-types/nodejs.js";
|
|
37
|
+
export { UnhandledRejection } from "./error-types/nodejs.unhandled.js";
|
|
38
|
+
export { UncaughtException } from "./error-types/nodejs.unhandled.js";
|
|
39
|
+
export { CanceledError } from "./error-types/tools.js";
|
|
40
|
+
export { TimeoutError } from "./error-types/tools.js";
|
|
37
41
|
//# sourceMappingURL=autoindex.d.ts.map
|
package/lib/autoindex.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoindex.d.ts","sourceRoot":"","sources":["../src/autoindex.ts"],"names":[],"mappings":"AAAA;;;;;;;gFAOgF;AAS/E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"autoindex.d.ts","sourceRoot":"","sources":["../src/autoindex.ts"],"names":[],"mappings":"AAAA;;;;;;;gFAOgF;AAS/E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC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,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
|
package/lib/autoindex.js
CHANGED
|
@@ -21,31 +21,47 @@ export { OpenSSLErrorCode } from "./codes/nodejs-re-export.js";
|
|
|
21
21
|
/* codes/wellknown-exit-codes.ts */
|
|
22
22
|
// Identifiers (1)
|
|
23
23
|
export { ExitCode } from "./codes/wellknown-exit-codes.js";
|
|
24
|
-
/* common/
|
|
25
|
-
// Identifiers (
|
|
26
|
-
export { Exit } from "./common/application.js";
|
|
27
|
-
export { InterruptError } from "./common/application.js";
|
|
28
|
-
export { UsageError } from "./common/application.js";
|
|
29
|
-
export { humanReadable } from "./common/base.js";
|
|
30
|
-
export { isHumanReadableError } from "./common/base.js";
|
|
31
|
-
export { NotError } from "./common/base.js";
|
|
24
|
+
/* common/base.ts */
|
|
25
|
+
// Identifiers (2)
|
|
32
26
|
export { ErrorWithCode } from "./common/base.js";
|
|
33
|
-
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
47
|
-
|
|
27
|
+
export { TypeErrorWithCode } from "./common/base.js";
|
|
28
|
+
/* common/human-readable.ts */
|
|
29
|
+
// Identifiers (3)
|
|
30
|
+
export { humanReadable } from "./common/human-readable.js";
|
|
31
|
+
export { isHumanReadable } from "./common/human-readable.js";
|
|
32
|
+
/* common/not-error.ts */
|
|
33
|
+
// Identifiers (1)
|
|
34
|
+
export { NotError } from "./common/not-error.js";
|
|
35
|
+
/* common/v8.ts */
|
|
36
|
+
// Identifiers (0)
|
|
37
|
+
/* error-types/application.ts */
|
|
38
|
+
// Identifiers (3)
|
|
39
|
+
export { Exit } from "./error-types/application.js";
|
|
40
|
+
export { InterruptError } from "./error-types/application.js";
|
|
41
|
+
export { UsageError } from "./error-types/application.js";
|
|
42
|
+
/* error-types/dependency.ts */
|
|
43
|
+
// Identifiers (2)
|
|
44
|
+
export { DependencyError } from "./error-types/dependency.js";
|
|
45
|
+
export { ChildProcessExitError } from "./error-types/dependency.js";
|
|
46
|
+
/* error-types/development.ts */
|
|
47
|
+
// Identifiers (5)
|
|
48
|
+
export { ProgramError } from "./error-types/development.js";
|
|
49
|
+
export { NotImplementedError } from "./error-types/development.js";
|
|
50
|
+
export { SoftwareDefectError } from "./error-types/development.js";
|
|
51
|
+
export { Assertion } from "./error-types/development.js";
|
|
52
|
+
export { VariableTypeError } from "./error-types/development.js";
|
|
53
|
+
export { isModuleResolutionError } from "./error-types/nodejs.js";
|
|
54
|
+
export { isNotExistsError } from "./error-types/nodejs.js";
|
|
55
|
+
export { isExistsError } from "./error-types/nodejs.js";
|
|
56
|
+
export { isTypeError } from "./error-types/nodejs.js";
|
|
57
|
+
export { isFileTypeError } from "./error-types/nodejs.js";
|
|
58
|
+
export { isNodeError } from "./error-types/nodejs.js";
|
|
59
|
+
/* error-types/nodejs.unhandled.ts */
|
|
60
|
+
// Identifiers (2)
|
|
61
|
+
export { UnhandledRejection } from "./error-types/nodejs.unhandled.js";
|
|
62
|
+
export { UncaughtException } from "./error-types/nodejs.unhandled.js";
|
|
63
|
+
/* error-types/tools.ts */
|
|
48
64
|
// Identifiers (2)
|
|
49
|
-
export {
|
|
50
|
-
export {
|
|
65
|
+
export { CanceledError } from "./error-types/tools.js";
|
|
66
|
+
export { TimeoutError } from "./error-types/tools.js";
|
|
51
67
|
//# sourceMappingURL=autoindex.js.map
|
package/lib/autoindex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoindex.js","sourceRoot":"","sources":["../src/autoindex.ts"],"names":[],"mappings":"AAAA;;;;;;;gFAOgF;AAChF,8BAA8B;AAC9B,wCAAwC;AACxC,0CAA0C;AAC1C,oBAAoB;AACpB,aAAa;AAEb,gCAAgC;AAC/B,kBAAk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
|
-
boundary?: CallableFunction;
|
|
7
|
-
/**
|
|
8
|
-
* cause属性的值
|
|
9
|
-
* @see {Error.cause}
|
|
10
|
-
*/
|
|
11
|
-
cause?: unknown;
|
|
12
|
-
}
|
|
13
|
-
export declare const humanReadable: unique symbol;
|
|
14
|
-
export interface IHumanReadable {
|
|
15
|
-
[humanReadable](): string;
|
|
16
|
-
}
|
|
17
|
-
export declare function isHumanReadableError(error: unknown): error is IHumanReadable;
|
|
18
|
-
/**
|
|
19
|
-
* 利用try...catch统一接口,或是用于分支条件等,未发生错误的情况
|
|
20
|
-
*/
|
|
21
|
-
export declare class NotError implements IHumanReadable {
|
|
22
|
-
readonly extra_message: string;
|
|
23
|
-
constructor(extra_message?: string);
|
|
24
|
-
get stack(): void;
|
|
25
|
-
get message(): void;
|
|
26
|
-
[humanReadable](): string;
|
|
27
|
-
}
|
|
1
|
+
import { humanReadable, type IHumanReadable } from './human-readable.js';
|
|
2
|
+
import type { IErrorOptions } from './type.js';
|
|
28
3
|
/**
|
|
4
|
+
* 最基本的错误类型
|
|
5
|
+
* 其他所有错误的基类
|
|
29
6
|
* @abstract
|
|
30
7
|
*/
|
|
31
8
|
export declare class ErrorWithCode extends Error implements IHumanReadable {
|
|
@@ -34,27 +11,6 @@ export declare class ErrorWithCode extends Error implements IHumanReadable {
|
|
|
34
11
|
get name(): string;
|
|
35
12
|
[humanReadable](): string;
|
|
36
13
|
}
|
|
37
|
-
|
|
38
|
-
* Error when something.cancel() is called
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare class CanceledError extends ErrorWithCode implements IHumanReadable {
|
|
42
|
-
constructor(opts?: IErrorOptions);
|
|
43
|
-
static is(e: unknown): e is CanceledError;
|
|
44
|
-
[humanReadable](): string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Error when something timeout
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export declare class TimeoutError extends ErrorWithCode implements IHumanReadable {
|
|
51
|
-
private readonly ms;
|
|
52
|
-
private readonly why;
|
|
53
|
-
private readonly what?;
|
|
54
|
-
constructor(ms: number, why?: string, opts?: IErrorOptions & {
|
|
55
|
-
what?: string;
|
|
56
|
-
});
|
|
57
|
-
static is(error: unknown): error is TimeoutError;
|
|
58
|
-
[humanReadable](): string;
|
|
14
|
+
export declare class TypeErrorWithCode extends ErrorWithCode {
|
|
59
15
|
}
|
|
60
16
|
//# sourceMappingURL=base.d.ts.map
|
package/lib/common/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/common/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/common/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAM,YAAW,cAAc;aAGhD,IAAI,EAAE,MAAM;gBAD5B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EAC5B,IAAI,CAAC,EAAE,aAAa;IAOrB,IAAoB,IAAI,WAEvB;IAED,CAAC,aAAa,CAAC;CASf;AAED,qBAAa,iBAAkB,SAAQ,aAAa;CAAG"}
|
package/lib/common/base.js
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const replaceStackTrace = Error.captureStackTrace ?? noop;
|
|
4
|
-
export const humanReadable = Symbol('humanReadable');
|
|
5
|
-
export function isHumanReadableError(error) {
|
|
6
|
-
return error instanceof Object && humanReadable in error;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* 利用try...catch统一接口,或是用于分支条件等,未发生错误的情况
|
|
10
|
-
*/
|
|
11
|
-
export class NotError {
|
|
12
|
-
extra_message;
|
|
13
|
-
constructor(extra_message = '') {
|
|
14
|
-
this.extra_message = extra_message;
|
|
15
|
-
}
|
|
16
|
-
get stack() {
|
|
17
|
-
throw new Error(`NotError 未被正确捕获 [hint: ${this.extra_message}]`);
|
|
18
|
-
}
|
|
19
|
-
get message() {
|
|
20
|
-
throw new Error(`NotError 未被正确捕获 [hint: ${this.extra_message}]`);
|
|
21
|
-
}
|
|
22
|
-
[humanReadable]() {
|
|
23
|
-
return `你不应该看到此消息。你无需尝试处理该错误,请联系开发者。[hint: ${this.extra_message}]`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import { humanReadable } from './human-readable.js';
|
|
2
|
+
import { captureStackTrace } from './v8.js';
|
|
26
3
|
/**
|
|
4
|
+
* 最基本的错误类型
|
|
5
|
+
* 其他所有错误的基类
|
|
27
6
|
* @abstract
|
|
28
7
|
*/
|
|
29
8
|
export class ErrorWithCode extends Error {
|
|
@@ -31,7 +10,7 @@ export class ErrorWithCode extends Error {
|
|
|
31
10
|
constructor(message, code, opts) {
|
|
32
11
|
super(message, opts);
|
|
33
12
|
this.code = code;
|
|
34
|
-
|
|
13
|
+
captureStackTrace(this, opts?.boundary ?? this.constructor);
|
|
35
14
|
}
|
|
36
15
|
get name() {
|
|
37
16
|
return this.constructor.name;
|
|
@@ -39,49 +18,18 @@ export class ErrorWithCode extends Error {
|
|
|
39
18
|
[humanReadable]() {
|
|
40
19
|
let msg;
|
|
41
20
|
if (this.code === 0) {
|
|
42
|
-
msg = '
|
|
21
|
+
msg = '未发生异常';
|
|
43
22
|
}
|
|
44
23
|
else {
|
|
45
|
-
msg =
|
|
24
|
+
msg = `异常状态 [${this.code}]`;
|
|
46
25
|
}
|
|
47
26
|
return `${msg}\n - 但是你不应该看到此信息,开发者忘记处理此种情况`;
|
|
48
27
|
}
|
|
49
28
|
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Error when something.cancel() is called
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
export class CanceledError extends ErrorWithCode {
|
|
56
|
-
constructor(opts) {
|
|
57
|
-
super('Canceled', ExitCode.INTERRUPT, opts);
|
|
58
|
-
}
|
|
59
|
-
static is(e) {
|
|
60
|
-
return e instanceof CanceledError;
|
|
61
|
-
}
|
|
62
|
-
[humanReadable]() {
|
|
63
|
-
return '操作已应用户要求而取消';
|
|
64
|
-
}
|
|
29
|
+
export class TypeErrorWithCode extends ErrorWithCode {
|
|
65
30
|
}
|
|
66
31
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @public
|
|
32
|
+
* 假装继承自 TypeError
|
|
69
33
|
*/
|
|
70
|
-
|
|
71
|
-
ms;
|
|
72
|
-
why;
|
|
73
|
-
what;
|
|
74
|
-
constructor(ms, why = 'no response', opts) {
|
|
75
|
-
super(`Timeout: ${why} in ${ms}ms${opts?.what ? ` (when ${opts.what})` : ''}`, ExitCode.TIMEOUT, opts);
|
|
76
|
-
this.ms = ms;
|
|
77
|
-
this.why = why;
|
|
78
|
-
this.what = opts?.what;
|
|
79
|
-
}
|
|
80
|
-
static is(error) {
|
|
81
|
-
return error instanceof TimeoutError;
|
|
82
|
-
}
|
|
83
|
-
[humanReadable]() {
|
|
84
|
-
return `操作超时: ${this.what ? this.what : '操作没有说明'}\n - 时长: ${this.ms}ms\n - 原因: ${this.why}`;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
34
|
+
Object.setPrototypeOf(TypeErrorWithCode.prototype, TypeError.prototype);
|
|
87
35
|
//# sourceMappingURL=base.js.map
|
package/lib/common/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/common/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/common/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAGtB;IAFjB,YACC,OAAe,EACC,IAAY,EAC5B,IAAoB;QAEpB,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAHL,SAAI,GAAJ,IAAI,CAAQ;QAK5B,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED,IAAoB,IAAI;QACvB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,CAAC,aAAa,CAAC;QACd,IAAI,GAAW,CAAC;QAChB,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACrB,GAAG,GAAG,OAAO,CAAC;QACf,CAAC;aAAM,CAAC;YACP,GAAG,GAAG,SAAS,IAAI,CAAC,IAAI,GAAG,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACD;AAED,MAAM,OAAO,iBAAkB,SAAQ,aAAa;CAAG;AAEvD;;GAEG;AACH,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"human-readable.d.ts","sourceRoot":"","sources":["../../src/common/human-readable.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,eAA0B,CAAC;AACrD,MAAM,WAAW,cAAc;IAC9B,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAEvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"human-readable.js","sourceRoot":"","sources":["../../src/common/human-readable.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAKrD,MAAM,UAAU,eAAe,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,MAAM,IAAI,aAAa,IAAI,KAAK,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { humanReadable, type IHumanReadable } from './human-readable.js';
|
|
2
|
+
/**
|
|
3
|
+
* 利用try...catch统一接口,或是用于分支条件等,未发生错误的情况
|
|
4
|
+
*/
|
|
5
|
+
export declare class NotError implements IHumanReadable {
|
|
6
|
+
readonly extra_message: string;
|
|
7
|
+
constructor(extra_message?: string);
|
|
8
|
+
get stack(): void;
|
|
9
|
+
get message(): void;
|
|
10
|
+
[humanReadable](): string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=not-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-error.d.ts","sourceRoot":"","sources":["../../src/common/not-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEzE;;GAEG;AACH,qBAAa,QAAS,YAAW,cAAc;aAClB,aAAa,EAAE,MAAM;gBAArB,aAAa,GAAE,MAAW;IAEtD,IAAI,KAAK,SAER;IACD,IAAI,OAAO,SAEV;IAED,CAAC,aAAa,CAAC;CAGf"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { humanReadable } from './human-readable.js';
|
|
2
|
+
/**
|
|
3
|
+
* 利用try...catch统一接口,或是用于分支条件等,未发生错误的情况
|
|
4
|
+
*/
|
|
5
|
+
export class NotError {
|
|
6
|
+
extra_message;
|
|
7
|
+
constructor(extra_message = '') {
|
|
8
|
+
this.extra_message = extra_message;
|
|
9
|
+
}
|
|
10
|
+
get stack() {
|
|
11
|
+
throw new Error(`NotError 未被正确捕获 [hint: ${this.extra_message}]`);
|
|
12
|
+
}
|
|
13
|
+
get message() {
|
|
14
|
+
throw new Error(`NotError 未被正确捕获 [hint: ${this.extra_message}]`);
|
|
15
|
+
}
|
|
16
|
+
[humanReadable]() {
|
|
17
|
+
return `你不应该看到此消息。你无需尝试处理该错误,请联系开发者。[hint: ${this.extra_message}]`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=not-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-error.js","sourceRoot":"","sources":["../../src/common/not-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,qBAAqB,CAAC;AAEzE;;GAEG;AACH,MAAM,OAAO,QAAQ;IACQ;IAA5B,YAA4B,gBAAwB,EAAE;QAA1B,kBAAa,GAAb,aAAa,CAAa;IAAG,CAAC;IAE1D,IAAI,KAAK;QACR,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,OAAO;QACV,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IAClE,CAAC;IAED,CAAC,aAAa,CAAC;QACd,OAAO,sCAAsC,IAAI,CAAC,aAAa,GAAG,CAAC;IACpE,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-shim.d.ts","sourceRoot":"","sources":["../../src/common/type-shim.ts"],"names":[],"mappings":"AAEA,iBAAiB;AACjB,MAAM,MAAM,YAAY,GAAG,OAAO,oBAAoB,EAAE,YAAY,CAAC;AAErE,iBAAiB;AACjB,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-shim.js","sourceRoot":"","sources":["../../src/common/type-shim.ts"],"names":[],"mappings":"AAAA,oDAAoD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/common/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/common/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v8.d.ts","sourceRoot":"","sources":["../../src/common/v8.ts"],"names":[],"mappings":"AAEA,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,KAAkC,CAAC"}
|
package/lib/common/v8.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v8.js","sourceRoot":"","sources":["../../src/common/v8.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,KAAI,CAAC;AAElB,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { ErrorWithCode
|
|
1
|
+
import { ErrorWithCode } from '../common/base.js';
|
|
2
|
+
import { humanReadable } from '../common/human-readable.js';
|
|
3
|
+
import type { IErrorOptions } from '../common/type.js';
|
|
2
4
|
/**
|
|
3
5
|
* 程序因为正常运行结束而退出
|
|
4
6
|
* catch到此错误时应直接重新抛出,不应做其他处理
|
|
@@ -17,6 +19,7 @@ export declare class InterruptError extends ErrorWithCode {
|
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* 由于错误的参数、配置导致错误
|
|
22
|
+
* 非程序问题
|
|
20
23
|
*/
|
|
21
24
|
export declare class UsageError extends ErrorWithCode {
|
|
22
25
|
constructor(message: string, opts?: IErrorOptions);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/error-types/application.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,IAAK,SAAQ,aAAa;gBAC1B,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa;CAG9C;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,aAAa;aAE/B,MAAM,EAAE,MAAM,CAAC,OAAO;gBAAtB,MAAM,EAAE,MAAM,CAAC,OAAO,EACtC,IAAI,CAAC,EAAE,aAAa;IAKZ,CAAC,aAAa,CAAC;CAGxB;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,aAAa;gBAChC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa;IAIxC,CAAC,aAAa,CAAC;CAGxB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExitCode } from '../codes/wellknown-exit-codes.js';
|
|
2
|
-
import { ErrorWithCode
|
|
2
|
+
import { ErrorWithCode } from '../common/base.js';
|
|
3
|
+
import { humanReadable } from '../common/human-readable.js';
|
|
3
4
|
/**
|
|
4
5
|
* 程序因为正常运行结束而退出
|
|
5
6
|
* catch到此错误时应直接重新抛出,不应做其他处理
|
|
@@ -25,6 +26,7 @@ export class InterruptError extends ErrorWithCode {
|
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* 由于错误的参数、配置导致错误
|
|
29
|
+
* 非程序问题
|
|
28
30
|
*/
|
|
29
31
|
export class UsageError extends ErrorWithCode {
|
|
30
32
|
constructor(message, opts) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/error-types/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D;;;GAGG;AACH,MAAM,OAAO,IAAK,SAAQ,aAAa;IACtC,YAAY,IAAY,EAAE,IAAoB;QAC7C,KAAK,CAAC,0BAA0B,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,aAAa;IAE/B;IADjB,YACiB,MAAsB,EACtC,IAAoB;QAEpB,KAAK,CAAC,uBAAuB,MAAM,EAAE,EAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAHjD,WAAM,GAAN,MAAM,CAAgB;IAIvC,CAAC;IAEQ,CAAC,aAAa,CAAC;QACvB,OAAO,SAAS,IAAI,CAAC,MAAM,OAAO,CAAC;IACpC,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,aAAa;IAC5C,YAAY,OAAe,EAAE,IAAoB;QAChD,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAEQ,CAAC,aAAa,CAAC;QACvB,OAAO,SAAS,IAAI,CAAC,OAAO,+BAA+B,CAAC;IAC7D,CAAC;CACD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ChildProcess, SignalsType } from '../common/type-shim.js';
|
|
2
|
+
import type { IErrorOptions } from '../common/type.js';
|
|
3
|
+
import { ProgramError } from './development.js';
|
|
4
|
+
export declare class DependencyError extends ProgramError {
|
|
5
|
+
}
|
|
6
|
+
interface IChildProcessErrorOptions extends IErrorOptions {
|
|
7
|
+
readonly commandline?: readonly string[];
|
|
8
|
+
readonly pid?: number;
|
|
9
|
+
readonly workingDirectory?: string;
|
|
10
|
+
readonly exitCode?: number;
|
|
11
|
+
readonly signal?: SignalsType;
|
|
12
|
+
readonly process?: ChildProcess;
|
|
13
|
+
}
|
|
14
|
+
export declare class ChildProcessExitError extends DependencyError {
|
|
15
|
+
pid?: number;
|
|
16
|
+
commandline?: readonly string[];
|
|
17
|
+
workingDirectory?: string;
|
|
18
|
+
exitCode?: number;
|
|
19
|
+
signal?: SignalsType;
|
|
20
|
+
process?: ChildProcess;
|
|
21
|
+
constructor({ pid, commandline, workingDirectory, exitCode, signal, process, ...opts }: IChildProcessErrorOptions);
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=dependency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency.d.ts","sourceRoot":"","sources":["../../src/error-types/dependency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,qBAAa,eAAgB,SAAQ,YAAY;CAAG;AAEpD,UAAU,yBAA0B,SAAQ,aAAa;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;CAChC;AAED,qBAAa,qBAAsB,SAAQ,eAAe;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,YAAY,CAAC;gBAElB,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,yBAAyB;CA2BjH"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ProgramError } from './development.js';
|
|
2
|
+
export class DependencyError extends ProgramError {
|
|
3
|
+
}
|
|
4
|
+
export class ChildProcessExitError extends DependencyError {
|
|
5
|
+
pid;
|
|
6
|
+
commandline;
|
|
7
|
+
workingDirectory;
|
|
8
|
+
exitCode;
|
|
9
|
+
signal;
|
|
10
|
+
process;
|
|
11
|
+
constructor({ pid, commandline, workingDirectory, exitCode, signal, process, ...opts }) {
|
|
12
|
+
let message = '';
|
|
13
|
+
message += pid ? `子进程 ${pid} ` : '未知子进程';
|
|
14
|
+
message += '非预期退出, ';
|
|
15
|
+
if (exitCode) {
|
|
16
|
+
message += `返回 ${exitCode}`;
|
|
17
|
+
}
|
|
18
|
+
else if (signal) {
|
|
19
|
+
message += `信号 ${signal}`;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
message += '可能未正常启动';
|
|
23
|
+
}
|
|
24
|
+
if (commandline) {
|
|
25
|
+
message += `\n 命令行: ${commandline.join(' ')}`;
|
|
26
|
+
}
|
|
27
|
+
if (workingDirectory) {
|
|
28
|
+
message += `\n 工作目录: ${workingDirectory}`;
|
|
29
|
+
}
|
|
30
|
+
super(message, opts);
|
|
31
|
+
this.pid = pid;
|
|
32
|
+
this.commandline = commandline;
|
|
33
|
+
this.workingDirectory = workingDirectory;
|
|
34
|
+
this.exitCode = exitCode;
|
|
35
|
+
this.signal = signal;
|
|
36
|
+
this.process = process;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=dependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency.js","sourceRoot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AAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ErrorWithCode } from '../common/base.js';
|
|
2
|
+
import type { IErrorOptions } from '../common/type.js';
|
|
3
|
+
/**
|
|
4
|
+
* 由于程序出现bug导致的各类异常
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class ProgramError extends ErrorWithCode {
|
|
7
|
+
constructor(message: string, opts?: IErrorOptions);
|
|
8
|
+
}
|
|
9
|
+
export declare class NotImplementedError extends ProgramError {
|
|
10
|
+
constructor(message?: string, opts?: IErrorOptions);
|
|
11
|
+
}
|
|
12
|
+
export declare class SoftwareDefectError extends ProgramError {
|
|
13
|
+
}
|
|
14
|
+
export declare class Assertion extends SoftwareDefectError {
|
|
15
|
+
static ok(value: unknown, message?: string, opts?: IErrorOptions): asserts value;
|
|
16
|
+
}
|
|
17
|
+
interface IVariableTypeErrorOptions extends IErrorOptions {
|
|
18
|
+
Expected?: Function;
|
|
19
|
+
variableName?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class VariableTypeError extends ProgramError {
|
|
22
|
+
readonly object: any;
|
|
23
|
+
readonly ExpectedClass?: Function;
|
|
24
|
+
constructor(object: any, { Expected, variableName, ...opts }?: IVariableTypeErrorOptions);
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=development.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"development.d.ts","sourceRoot":"","sources":["../../src/error-types/development.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,8BAAsB,YAAa,SAAQ,aAAa;gBAC3C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa;CAGjD;AAED,qBAAa,mBAAoB,SAAQ,YAAY;gBACxC,OAAO,GAAE,MAAiB,EAAE,IAAI,CAAC,EAAE,aAAa;CAG5D;AAED,qBAAa,mBAAoB,SAAQ,YAAY;CAAG;AAExD,qBAAa,SAAU,SAAQ,mBAAmB;IACjD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,MAAe,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,KAAK;CASxF;AAED,UAAU,yBAA0B,SAAQ,aAAa;IACxD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,iBAAkB,SAAQ,YAAY;aAIjC,MAAM,EAAE,GAAG;IAH5B,SAAgB,aAAa,CAAC,EAAE,QAAQ,CAAC;gBAGxB,MAAM,EAAE,GAAG,EAC3B,EAAE,QAAQ,EAAE,YAAmB,EAAE,GAAG,IAAI,EAAE,GAAE,yBAA8B;CAiB3E"}
|