@thi.ng/errors 2.5.50 → 2.6.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/README.md +2 -2
- package/package.json +2 -2
- package/unsupported.d.ts +27 -0
- package/unsupported.js +12 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 212 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -72,7 +72,7 @@ For Node.js REPL:
|
|
|
72
72
|
const err = await import("@thi.ng/errors");
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
75
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 849 bytes
|
|
76
76
|
|
|
77
77
|
## Dependencies
|
|
78
78
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/errors",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Custom error types and error factory functions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"alias": "err",
|
|
100
100
|
"year": 2018
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "e7a21b9d2a188fa04d4c893d8531c40fbc0f4c06\n"
|
|
103
103
|
}
|
package/unsupported.d.ts
CHANGED
|
@@ -10,5 +10,32 @@ export declare const UnsupportedOperationError: {
|
|
|
10
10
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
11
11
|
stackTraceLimit: number;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Throws {@link UnsupportedOperationError} error.
|
|
15
|
+
*
|
|
16
|
+
* @param msg
|
|
17
|
+
*/
|
|
18
|
+
export declare const unsupportedOp: (msg?: any) => never;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use {@link unsupportedOp}
|
|
21
|
+
*/
|
|
13
22
|
export declare const unsupported: (msg?: any) => never;
|
|
23
|
+
export declare const UnsupportedFeatureError: {
|
|
24
|
+
new (msg?: any): {
|
|
25
|
+
origMessage: string;
|
|
26
|
+
name: string;
|
|
27
|
+
message: string;
|
|
28
|
+
stack?: string;
|
|
29
|
+
cause?: unknown;
|
|
30
|
+
};
|
|
31
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
32
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
33
|
+
stackTraceLimit: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Throws {@link UnsupportedFeatureError} error.
|
|
37
|
+
*
|
|
38
|
+
* @param msg
|
|
39
|
+
*/
|
|
40
|
+
export declare const unsupportedFeature: (msg?: any) => never;
|
|
14
41
|
//# sourceMappingURL=unsupported.d.ts.map
|
package/unsupported.js
CHANGED
|
@@ -2,10 +2,20 @@ import { defError } from "./deferror.js";
|
|
|
2
2
|
const UnsupportedOperationError = defError(
|
|
3
3
|
() => "unsupported operation"
|
|
4
4
|
);
|
|
5
|
-
const
|
|
5
|
+
const unsupportedOp = (msg) => {
|
|
6
6
|
throw new UnsupportedOperationError(msg);
|
|
7
7
|
};
|
|
8
|
+
const unsupported = unsupportedOp;
|
|
9
|
+
const UnsupportedFeatureError = defError(
|
|
10
|
+
() => "unsupported feature"
|
|
11
|
+
);
|
|
12
|
+
const unsupportedFeature = (msg) => {
|
|
13
|
+
throw new UnsupportedFeatureError(msg);
|
|
14
|
+
};
|
|
8
15
|
export {
|
|
16
|
+
UnsupportedFeatureError,
|
|
9
17
|
UnsupportedOperationError,
|
|
10
|
-
unsupported
|
|
18
|
+
unsupported,
|
|
19
|
+
unsupportedFeature,
|
|
20
|
+
unsupportedOp
|
|
11
21
|
};
|