immediate-error 6.0.0 → 6.1.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 -0
- package/index.d.ts +7 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ immediateError('Aaaaah') // this will throw a regular Error with the message "Aa
|
|
|
12
12
|
|
|
13
13
|
immediateError('Aaaaah', ErrorType.BaseError) // does the same thing as above
|
|
14
14
|
|
|
15
|
+
immediateError('Aggregate error', ErrorType.AggregateError) // throws an AggregateError
|
|
16
|
+
|
|
15
17
|
immediateError('Assertion error', ErrorType.AssertionError) // throws an AssertionError (from the assert-fn module)
|
|
16
18
|
|
|
17
19
|
immediateError('Assertion error', ErrorType.NativeAssertionError) // throws an AssertionError (from the node:assert module)
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export enum ErrorType {
|
|
2
2
|
BaseError = 0,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
AggregateError = 1,
|
|
4
|
+
AssertionError = 2,
|
|
5
|
+
RangeError = 3,
|
|
6
|
+
ReferenceError = 4,
|
|
7
|
+
SyntaxError = 5,
|
|
8
|
+
TypeError = 6,
|
|
9
|
+
NativeAssertionError = 7
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export function immediateError(message?: string, errorType?: ErrorType | Function): void
|