@thi.ng/errors 2.4.20 → 2.5.1
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/CHANGELOG.md +7 -1
- package/README.md +1 -1
- package/assert.d.ts +1 -0
- package/deferror.d.ts +20 -2
- package/deferror.js +2 -0
- package/ensure.d.ts +4 -4
- package/illegal-arguments.d.ts +1 -0
- package/illegal-arity.d.ts +1 -0
- package/illegal-state.d.ts +1 -0
- package/io.d.ts +2 -0
- package/out-of-bounds.d.ts +1 -0
- package/package.json +7 -7
- package/unsupported.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-03-
|
|
3
|
+
- **Last updated**: 2024-03-17T15:23:29Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [2.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/errors@2.5.0) (2024-03-13)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add CustomError interface, update docs, add tests ([d2ea8b2](https://github.com/thi-ng/umbrella/commit/d2ea8b2))
|
|
17
|
+
|
|
12
18
|
### [2.4.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/errors@2.4.1) (2023-11-09)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
package/assert.d.ts
CHANGED
package/deferror.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export interface CustomError extends Error {
|
|
3
|
+
/**
|
|
4
|
+
* The original message given to the error ctor (prior to applying
|
|
5
|
+
* prefix/suffix). If none was given this will be an empty string.
|
|
6
|
+
*/
|
|
7
|
+
origMessage: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Defines a custom error type/class which implements the {@link CustomError}
|
|
11
|
+
* interface.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* All error types in this package are defined via this function.
|
|
15
|
+
*
|
|
16
|
+
* @param prefix
|
|
17
|
+
* @param suffix
|
|
18
|
+
*/
|
|
19
|
+
export declare const defError: <T = string>(prefix: (msg?: T) => string, suffix?: (msg?: T) => string) => {
|
|
20
|
+
new (msg?: T): {
|
|
21
|
+
origMessage: string;
|
|
4
22
|
name: string;
|
|
5
23
|
message: string;
|
|
6
24
|
stack?: string | undefined;
|
package/deferror.js
CHANGED
package/ensure.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Higher-order function to define
|
|
2
|
+
* Higher-order function to define assurance assertions. Takes a `pred`icate
|
|
3
3
|
* function and an `expected` (type) name, returns a new function which accepts
|
|
4
|
-
* 2 args
|
|
5
|
-
* `x` for non-
|
|
6
|
-
* `x` is nullish) and iff {@link assert} is enabled, throws a
|
|
4
|
+
* 2 args: an arbitrary value `x` and optional error `msg`. When called, checks
|
|
5
|
+
* `x` for non-nullishness and if so applies given `pred`icate. If result is
|
|
6
|
+
* false (or `x` is nullish) and iff {@link assert} is enabled, throws a
|
|
7
7
|
* {@link AssertionError} with given `msg` (or a constructed default msg).
|
|
8
8
|
* Otherwise function is a no-op.
|
|
9
9
|
*
|
package/illegal-arguments.d.ts
CHANGED
package/illegal-arity.d.ts
CHANGED
package/illegal-state.d.ts
CHANGED
package/io.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
export declare const IOError: {
|
|
3
3
|
new (msg?: any): {
|
|
4
|
+
origMessage: string;
|
|
4
5
|
name: string;
|
|
5
6
|
message: string;
|
|
6
7
|
stack?: string | undefined;
|
|
@@ -13,6 +14,7 @@ export declare const IOError: {
|
|
|
13
14
|
export declare const ioerror: (msg?: any) => never;
|
|
14
15
|
export declare const FileNotFoundError: {
|
|
15
16
|
new (msg?: any): {
|
|
17
|
+
origMessage: string;
|
|
16
18
|
name: string;
|
|
17
19
|
message: string;
|
|
18
20
|
stack?: string | undefined;
|
package/out-of-bounds.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/errors",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Custom error types and error factory functions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@microsoft/api-extractor": "^7.
|
|
40
|
-
"@types/node": "^20.11.
|
|
41
|
-
"esbuild": "^0.20.
|
|
39
|
+
"@microsoft/api-extractor": "^7.42.3",
|
|
40
|
+
"@types/node": "^20.11.26",
|
|
41
|
+
"esbuild": "^0.20.1",
|
|
42
42
|
"rimraf": "^5.0.5",
|
|
43
|
-
"typedoc": "^0.25.
|
|
44
|
-
"typescript": "^5.
|
|
43
|
+
"typedoc": "^0.25.12",
|
|
44
|
+
"typescript": "^5.4.2"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
47
47
|
"assert",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"thi.ng": {
|
|
98
98
|
"year": 2018
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "bc0f3cb07d6f1cab6dbdc5ff57428f5484e711bb\n"
|
|
101
101
|
}
|