@little-nebulae/error 1.2.0 → 1.4.0
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/dist/index.d.ts +22 -4
- package/dist/index.js +32 -2
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
|
@@ -88,11 +88,29 @@ export declare function isError(value: unknown): value is Error;
|
|
|
88
88
|
//#region src/helpers/is/range-error.d.ts
|
|
89
89
|
export declare function isRangeError(value: unknown): value is RangeError;
|
|
90
90
|
//#endregion
|
|
91
|
+
//#region src/helpers/is/aggregate-error.d.ts
|
|
92
|
+
export declare function isAggregateError(error: Error): error is AggregateError;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/helpers/is/eval-error.d.ts
|
|
95
|
+
export declare function isEvalError(error: Error): error is EvalError;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/helpers/is/reference-error.d.ts
|
|
98
|
+
export declare function isReferenceError(error: Error): error is ReferenceError;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/helpers/is/syntax-error.d.ts
|
|
101
|
+
export declare function isSyntaxError(error: Error): error is SyntaxError;
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/helpers/is/type-error.d.ts
|
|
104
|
+
export declare function isTypeError(error: Error): error is TypeError;
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/helpers/is/uri-error.d.ts
|
|
107
|
+
export declare function isUriError(error: Error): error is URIError;
|
|
108
|
+
//#endregion
|
|
91
109
|
//#region src/helpers/compose-error-message.d.ts
|
|
92
110
|
export declare const DEFAULT_FAILURE_REASON = "some unexpected error";
|
|
93
|
-
export declare function composeErrorMessage
|
|
94
|
-
operation:
|
|
95
|
-
reason
|
|
96
|
-
}):
|
|
111
|
+
export declare function composeErrorMessage({ operation, reason }: {
|
|
112
|
+
operation: string;
|
|
113
|
+
reason?: string;
|
|
114
|
+
}): string;
|
|
97
115
|
//#endregion
|
|
98
116
|
export type { BaseErrorMeta, BaseErrorType };
|
package/dist/index.js
CHANGED
|
@@ -80,10 +80,40 @@ function isStackOverflowError(value) {
|
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
//#endregion
|
|
83
|
+
//#region src/helpers/is/aggregate-error.ts
|
|
84
|
+
function isAggregateError(error) {
|
|
85
|
+
return error.name === AggregateError.name;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/helpers/is/eval-error.ts
|
|
89
|
+
function isEvalError(error) {
|
|
90
|
+
return error.name === EvalError.name;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/helpers/is/reference-error.ts
|
|
94
|
+
function isReferenceError(error) {
|
|
95
|
+
return error.name === ReferenceError.name;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/helpers/is/syntax-error.ts
|
|
99
|
+
function isSyntaxError(error) {
|
|
100
|
+
return error.name === SyntaxError.name;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/helpers/is/type-error.ts
|
|
104
|
+
function isTypeError(error) {
|
|
105
|
+
return error.name === TypeError.name;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/helpers/is/uri-error.ts
|
|
109
|
+
function isUriError(error) {
|
|
110
|
+
return error.name === URIError.name;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
83
113
|
//#region src/helpers/compose-error-message.ts
|
|
84
114
|
const DEFAULT_FAILURE_REASON = "some unexpected error";
|
|
85
|
-
function composeErrorMessage({ operation, reason }) {
|
|
115
|
+
function composeErrorMessage({ operation, reason = DEFAULT_FAILURE_REASON }) {
|
|
86
116
|
return `Failed to ${operation} due to ${reason}.`;
|
|
87
117
|
}
|
|
88
118
|
//#endregion
|
|
89
|
-
export { ABORTED_ERROR_CODE, ABORT_ERROR_CODE, ABORT_ERROR_NAME, AbortedError, BaseError, DEFAULT_FAILURE_REASON, INTERNAL_ERROR_NAME, STACK_OVERFLOWED_ERROR_CODE, StackOverflowedError, TIMED_OUT_ERROR_CODE, TIMEOUT_ERROR_NAME, TimedOutError, UNEXPECTED_ERROR_CODE, UnexpectedError, composeErrorMessage, isAbortError, isError, isInternalError, isRangeError, isStackOverflowError, isTimeoutError };
|
|
119
|
+
export { ABORTED_ERROR_CODE, ABORT_ERROR_CODE, ABORT_ERROR_NAME, AbortedError, BaseError, DEFAULT_FAILURE_REASON, INTERNAL_ERROR_NAME, STACK_OVERFLOWED_ERROR_CODE, StackOverflowedError, TIMED_OUT_ERROR_CODE, TIMEOUT_ERROR_NAME, TimedOutError, UNEXPECTED_ERROR_CODE, UnexpectedError, composeErrorMessage, isAbortError, isAggregateError, isError, isEvalError, isInternalError, isRangeError, isReferenceError, isStackOverflowError, isSyntaxError, isTimeoutError, isTypeError, isUriError };
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@little-nebulae/error",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"type": "module",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"exports": {
|
|
10
11
|
".": "./dist/index.js",
|
|
11
12
|
"./package.json": "./package.json"
|
|
@@ -16,13 +17,13 @@
|
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"@arethetypeswrong/core": "0.18.5",
|
|
19
|
-
"@
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"oxlint
|
|
20
|
+
"@oxc-node/cli": "0.1.6",
|
|
21
|
+
"@types/node": "26.6.5",
|
|
22
|
+
"oxfmt": "0.72.0",
|
|
23
|
+
"oxlint": "1.87.0",
|
|
24
|
+
"oxlint-tsgolint": "7.0.2004",
|
|
23
25
|
"publint": "0.3.25",
|
|
24
|
-
"tsdown": "0.23.
|
|
25
|
-
"tsx": "4.23.15",
|
|
26
|
+
"tsdown": "0.23.1",
|
|
26
27
|
"type-fest": "5.10.0",
|
|
27
28
|
"typescript": "7.0.2",
|
|
28
29
|
"vitest": "5.0.3"
|
|
@@ -33,13 +34,13 @@
|
|
|
33
34
|
"devEngines": {
|
|
34
35
|
"packageManager": {
|
|
35
36
|
"name": "pnpm",
|
|
36
|
-
"version": "12.
|
|
37
|
+
"version": "12.11.2",
|
|
37
38
|
"onFail": "warn"
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
42
|
"build": "tsdown",
|
|
42
|
-
"try": "
|
|
43
|
+
"try": "oxnode ./src/try.ts",
|
|
43
44
|
"fmt": "oxfmt --disable-nested-config",
|
|
44
45
|
"fmt:check": "oxfmt --check --disable-nested-config",
|
|
45
46
|
"lint": "oxlint --disable-nested-config",
|