@idlebox/errors 0.1.17 → 0.1.19

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.
Files changed (81) hide show
  1. package/lib/autoindex.d.ts +28 -23
  2. package/lib/autoindex.d.ts.map +1 -1
  3. package/lib/autoindex.js +42 -25
  4. package/lib/autoindex.js.map +1 -1
  5. package/lib/codes/wellknown-exit-codes.d.ts +19 -2
  6. package/lib/codes/wellknown-exit-codes.d.ts.map +1 -1
  7. package/lib/codes/wellknown-exit-codes.js +18 -1
  8. package/lib/codes/wellknown-exit-codes.js.map +1 -1
  9. package/lib/common/base.d.ts +5 -49
  10. package/lib/common/base.d.ts.map +1 -1
  11. package/lib/common/base.js +10 -62
  12. package/lib/common/base.js.map +1 -1
  13. package/lib/common/human-readable.d.ts +6 -0
  14. package/lib/common/human-readable.d.ts.map +1 -0
  15. package/lib/common/human-readable.js +5 -0
  16. package/lib/common/human-readable.js.map +1 -0
  17. package/lib/common/not-error.d.ts +12 -0
  18. package/lib/common/not-error.d.ts.map +1 -0
  19. package/lib/common/not-error.js +20 -0
  20. package/lib/common/not-error.js.map +1 -0
  21. package/lib/common/type-shim.d.ts +5 -0
  22. package/lib/common/type-shim.d.ts.map +1 -0
  23. package/lib/common/type-shim.js +3 -0
  24. package/lib/common/type-shim.js.map +1 -0
  25. package/lib/common/type.d.ts +13 -0
  26. package/lib/common/type.d.ts.map +1 -0
  27. package/lib/common/type.js +2 -0
  28. package/lib/common/type.js.map +1 -0
  29. package/lib/common/v8.d.ts +3 -0
  30. package/lib/common/v8.d.ts.map +1 -0
  31. package/lib/common/v8.js +4 -0
  32. package/lib/common/v8.js.map +1 -0
  33. package/lib/{common → error-types}/application.d.ts +4 -1
  34. package/lib/error-types/application.d.ts.map +1 -0
  35. package/lib/{common → error-types}/application.js +3 -1
  36. package/lib/error-types/application.js.map +1 -0
  37. package/lib/error-types/dependency.d.ts +24 -0
  38. package/lib/error-types/dependency.d.ts.map +1 -0
  39. package/lib/error-types/dependency.js +39 -0
  40. package/lib/error-types/dependency.js.map +1 -0
  41. package/lib/error-types/development.d.ts +27 -0
  42. package/lib/error-types/development.d.ts.map +1 -0
  43. package/lib/error-types/development.js +50 -0
  44. package/lib/error-types/development.js.map +1 -0
  45. package/lib/error-types/nodejs.d.ts.map +1 -0
  46. package/lib/error-types/nodejs.js.map +1 -0
  47. package/lib/{common/unhandled-errors.d.ts → error-types/nodejs.unhandled.d.ts} +2 -6
  48. package/lib/error-types/nodejs.unhandled.d.ts.map +1 -0
  49. package/lib/{common/unhandled-errors.js → error-types/nodejs.unhandled.js} +2 -5
  50. package/lib/{common/unhandled-errors.js.map → error-types/nodejs.unhandled.js.map} +1 -1
  51. package/lib/error-types/tools.d.ts +28 -0
  52. package/lib/error-types/tools.d.ts.map +1 -0
  53. package/lib/error-types/tools.js +41 -0
  54. package/lib/error-types/tools.js.map +1 -0
  55. package/package.json +2 -2
  56. package/src/autoindex.ts +47 -30
  57. package/src/codes/wellknown-exit-codes.ts +22 -1
  58. package/src/common/base.ts +11 -90
  59. package/src/common/human-readable.ts +8 -0
  60. package/src/common/not-error.ts +19 -0
  61. package/src/common/type-shim.ts +7 -0
  62. package/src/common/type.ts +13 -0
  63. package/src/common/v8.ts +4 -0
  64. package/src/{common → error-types}/application.ts +4 -1
  65. package/src/error-types/dependency.ts +51 -0
  66. package/src/error-types/development.ts +61 -0
  67. package/src/{common/unhandled-errors.ts → error-types/nodejs.unhandled.ts} +1 -4
  68. package/src/error-types/tools.ts +48 -0
  69. package/lib/common/application.d.ts.map +0 -1
  70. package/lib/common/application.js.map +0 -1
  71. package/lib/common/development.d.ts +0 -12
  72. package/lib/common/development.d.ts.map +0 -1
  73. package/lib/common/development.js +0 -24
  74. package/lib/common/development.js.map +0 -1
  75. package/lib/common/nodejs.d.ts.map +0 -1
  76. package/lib/common/nodejs.js.map +0 -1
  77. package/lib/common/unhandled-errors.d.ts.map +0 -1
  78. package/src/common/development.ts +0 -24
  79. /package/lib/{common → error-types}/nodejs.d.ts +0 -0
  80. /package/lib/{common → error-types}/nodejs.js +0 -0
  81. /package/src/{common → error-types}/nodejs.ts +0 -0
@@ -10,28 +10,33 @@ 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 { CanceledError } from "./common/base.js";
23
- export { TimeoutError } from "./common/base.js";
24
- export { ProgramError } from "./common/development.js";
25
- export { NotImplementedError } from "./common/development.js";
26
- export { SoftwareDefectError } from "./common/development.js";
27
- export { Assertion } from "./common/development.js";
28
- export type { OpenSSLException } from "./common/nodejs.js";
29
- export { isModuleResolutionError } from "./common/nodejs.js";
30
- export { isNotExistsError } from "./common/nodejs.js";
31
- export { isExistsError } from "./common/nodejs.js";
32
- export { isTypeError } from "./common/nodejs.js";
33
- export { isFileTypeError } from "./common/nodejs.js";
34
- export { isNodeError } from "./common/nodejs.js";
35
- export { UnhandledRejection } from "./common/unhandled-errors.js";
36
- export { UncaughtException } from "./common/unhandled-errors.js";
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 { ProxiedError } from "./error-types/nodejs.unhandled.js";
38
+ export { UnhandledRejection } from "./error-types/nodejs.unhandled.js";
39
+ export { UncaughtException } from "./error-types/nodejs.unhandled.js";
40
+ export { CanceledError } from "./error-types/tools.js";
41
+ export { TimeoutError } from "./error-types/tools.js";
37
42
  //# sourceMappingURL=autoindex.d.ts.map
@@ -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,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,aAAa,EA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AAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
package/lib/autoindex.js CHANGED
@@ -21,31 +21,48 @@ 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/application.ts */
25
- // Identifiers (3)
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 { CanceledError } from "./common/base.js";
34
- export { TimeoutError } from "./common/base.js";
35
- /* common/development.ts */
36
- // Identifiers (4)
37
- export { ProgramError } from "./common/development.js";
38
- export { NotImplementedError } from "./common/development.js";
39
- export { SoftwareDefectError } from "./common/development.js";
40
- export { Assertion } from "./common/development.js";
41
- export { isModuleResolutionError } from "./common/nodejs.js";
42
- export { isNotExistsError } from "./common/nodejs.js";
43
- export { isExistsError } from "./common/nodejs.js";
44
- export { isTypeError } from "./common/nodejs.js";
45
- export { isFileTypeError } from "./common/nodejs.js";
46
- export { isNodeError } from "./common/nodejs.js";
47
- /* common/unhandled-errors.ts */
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 (3)
61
+ export { ProxiedError } from "./error-types/nodejs.unhandled.js";
62
+ export { UnhandledRejection } from "./error-types/nodejs.unhandled.js";
63
+ export { UncaughtException } from "./error-types/nodejs.unhandled.js";
64
+ /* error-types/tools.ts */
48
65
  // Identifiers (2)
49
- export { UnhandledRejection } from "./common/unhandled-errors.js";
50
- export { UncaughtException } from "./common/unhandled-errors.js";
66
+ export { CanceledError } from "./error-types/tools.js";
67
+ export { TimeoutError } from "./error-types/tools.js";
51
68
  //# sourceMappingURL=autoindex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"autoindex.js","sourceRoot":"","sources":["../src/autoindex.ts"],"names":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16
  */
17
17
  TIMEOUT = 4,
18
18
  /**
19
- * 由于程序代码不完善导致的错误
19
+ * 工作状态异常
20
+ * 状态转移错误等
20
21
  */
21
- PROGRAM = 66
22
+ INVALID_STATE = 5,
23
+ /**
24
+ * 由于程序代码不完善导致的未知错误
25
+ */
26
+ PROGRAM = 66,
27
+ /**
28
+ * 由资源引起的错误,例如文件不存在、网络错误等
29
+ */
30
+ RESOURCE = 100,
31
+ /**
32
+ * 重复操作,例如重复调用dispose
33
+ */
34
+ DUPLICATE = 101,
35
+ /**
36
+ * 未曾设想的错误
37
+ */
38
+ UNKNOWN = 233
22
39
  }
23
40
  //# sourceMappingURL=wellknown-exit-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wellknown-exit-codes.d.ts","sourceRoot":"","sources":["../../src/codes/wellknown-exit-codes.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IACnB;;OAEG;IACH,SAAS,IAAI;IAEb;;OAEG;IACH,SAAS,IAAI;IAEb;;OAEG;IACH,KAAK,IAAI;IAET;;OAEG;IACH,OAAO,IAAI;IAEX;;OAEG;IACH,OAAO,KAAK;CACZ"}
1
+ {"version":3,"file":"wellknown-exit-codes.d.ts","sourceRoot":"","sources":["../../src/codes/wellknown-exit-codes.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IACnB;;OAEG;IACH,SAAS,IAAI;IAEb;;OAEG;IACH,SAAS,IAAI;IAEb;;OAEG;IACH,KAAK,IAAI;IAET;;OAEG;IACH,OAAO,IAAI;IAEX;;;OAGG;IACH,aAAa,IAAI;IAEjB;;OAEG;IACH,OAAO,KAAK;IAEZ;;OAEG;IACH,QAAQ,MAAM;IAEd;;OAEG;IACH,SAAS,MAAM;IAEf;;OAEG;IACH,OAAO,MAAM;CACb"}
@@ -17,8 +17,25 @@ export var ExitCode;
17
17
  */
18
18
  ExitCode[ExitCode["TIMEOUT"] = 4] = "TIMEOUT";
19
19
  /**
20
- * 由于程序代码不完善导致的错误
20
+ * 工作状态异常
21
+ * 状态转移错误等
22
+ */
23
+ ExitCode[ExitCode["INVALID_STATE"] = 5] = "INVALID_STATE";
24
+ /**
25
+ * 由于程序代码不完善导致的未知错误
21
26
  */
22
27
  ExitCode[ExitCode["PROGRAM"] = 66] = "PROGRAM";
28
+ /**
29
+ * 由资源引起的错误,例如文件不存在、网络错误等
30
+ */
31
+ ExitCode[ExitCode["RESOURCE"] = 100] = "RESOURCE";
32
+ /**
33
+ * 重复操作,例如重复调用dispose
34
+ */
35
+ ExitCode[ExitCode["DUPLICATE"] = 101] = "DUPLICATE";
36
+ /**
37
+ * 未曾设想的错误
38
+ */
39
+ ExitCode[ExitCode["UNKNOWN"] = 233] = "UNKNOWN";
23
40
  })(ExitCode || (ExitCode = {}));
24
41
  //# sourceMappingURL=wellknown-exit-codes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wellknown-exit-codes.js","sourceRoot":"","sources":["../../src/codes/wellknown-exit-codes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAyBX;AAzBD,WAAY,QAAQ;IACnB;;OAEG;IACH,iDAAa,CAAA;IAEb;;OAEG;IACH,iDAAa,CAAA;IAEb;;OAEG;IACH,yCAAS,CAAA;IAET;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,8CAAY,CAAA;AACb,CAAC,EAzBW,QAAQ,KAAR,QAAQ,QAyBnB"}
1
+ {"version":3,"file":"wellknown-exit-codes.js","sourceRoot":"","sources":["../../src/codes/wellknown-exit-codes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QA8CX;AA9CD,WAAY,QAAQ;IACnB;;OAEG;IACH,iDAAa,CAAA;IAEb;;OAEG;IACH,iDAAa,CAAA;IAEb;;OAEG;IACH,yCAAS,CAAA;IAET;;OAEG;IACH,6CAAW,CAAA;IAEX;;;OAGG;IACH,yDAAiB,CAAA;IAEjB;;OAEG;IACH,8CAAY,CAAA;IAEZ;;OAEG;IACH,iDAAc,CAAA;IAEd;;OAEG;IACH,mDAAe,CAAA;IAEf;;OAEG;IACH,+CAAa,CAAA;AACd,CAAC,EA9CW,QAAQ,KAAR,QAAQ,QA8CnB"}
@@ -1,31 +1,8 @@
1
- export interface IErrorOptions {
2
- /**
3
- * stack属性的边界函数
4
- * @see {Error.captureStackTrace}
5
- */
6
- 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
  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,EACpC,IAAI,CAAC,EAAE,aAAa,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;IAMzC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY;IAIvC,CAAC,aAAa,CAAC;CAGxB"}
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"}
@@ -1,29 +1,8 @@
1
- import { ExitCode } from '../codes/wellknown-exit-codes.js';
2
- function noop() { }
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
- replaceStackTrace(this, opts?.boundary ?? this.constructor);
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 = `程序以非0状态正常结束,状态码:${this.code}`;
24
+ msg = `异常状态 [${this.code}]`;
46
25
  }
47
26
  return `${msg}\n - 但是你不应该看到此信息,开发者忘记处理此种情况`;
48
27
  }
49
28
  }
50
- Object.setPrototypeOf(ErrorWithCode.prototype, Error.prototype);
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
- * Error when something timeout
68
- * @public
32
+ * 假装继承自 TypeError
69
33
  */
70
- export class TimeoutError extends ErrorWithCode {
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
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/common/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,SAAS,IAAI,KAAI,CAAC;AAElB,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC;AAgB1D,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAKrD,MAAM,UAAU,oBAAoB,CAAC,KAAc;IAClD,OAAO,KAAK,YAAY,MAAM,IAAI,aAAa,IAAI,KAAK,CAAC;AAC1D,CAAC;AAED;;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;AAED;;GAEG;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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YAAY,YAAY,CAAC;IACtC,CAAC;IAEQ,CAAC,aAAa,CAAC;QACvB,OAAO,SAAS,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,aAAa,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,GAAG,EAAE,CAAC;IAC/F,CAAC;CACD"}
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,6 @@
1
+ export declare const humanReadable: unique symbol;
2
+ export interface IHumanReadable {
3
+ [humanReadable](): string;
4
+ }
5
+ export declare function isHumanReadable(error: unknown): error is IHumanReadable;
6
+ //# sourceMappingURL=human-readable.d.ts.map
@@ -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,5 @@
1
+ export const humanReadable = Symbol('humanReadable');
2
+ export function isHumanReadable(error) {
3
+ return error instanceof Object && humanReadable in error;
4
+ }
5
+ //# sourceMappingURL=human-readable.js.map
@@ -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,5 @@
1
+ /** @ts-ignore */
2
+ export type ChildProcess = import('node:child_process').ChildProcess;
3
+ /** @ts-ignore */
4
+ export type SignalsType = NodeJS.Signals;
5
+ //# sourceMappingURL=type-shim.d.ts.map
@@ -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,3 @@
1
+ // biome-ignore-all lint/suspicious/noTsIgnore: 切换文件
2
+ export {};
3
+ //# sourceMappingURL=type-shim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-shim.js","sourceRoot":"","sources":["../../src/common/type-shim.ts"],"names":[],"mappings":"AAAA,oDAAoD"}
@@ -0,0 +1,13 @@
1
+ export interface IErrorOptions {
2
+ /**
3
+ * stack属性的边界函数
4
+ * @see {Error.captureStackTrace}
5
+ */
6
+ boundary?: CallableFunction;
7
+ /**
8
+ * cause属性的值
9
+ * @see {Error.cause}
10
+ */
11
+ cause?: unknown;
12
+ }
13
+ //# sourceMappingURL=type.d.ts.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/common/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** @internal */
2
+ export declare const captureStackTrace: any;
3
+ //# sourceMappingURL=v8.d.ts.map
@@ -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"}
@@ -0,0 +1,4 @@
1
+ function noop() { }
2
+ /** @internal */
3
+ export const captureStackTrace = Error.captureStackTrace ?? noop;
4
+ //# sourceMappingURL=v8.js.map
@@ -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, humanReadable, type IErrorOptions } from './base.js';
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, humanReadable } from './base.js';
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"}