@augment-vir/common 31.68.1 → 31.68.2
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type NoInputsFunction
|
|
1
|
+
import { type NoInputsFunction } from '@augment-vir/core';
|
|
2
|
+
import { type RequireOneOrNone } from 'type-fest';
|
|
2
3
|
/**
|
|
3
4
|
* Options for {@link wrapInTry}.
|
|
4
5
|
*
|
|
@@ -6,7 +7,7 @@ import { type NoInputsFunction, type PartialWithUndefined } from '@augment-vir/c
|
|
|
6
7
|
* @category Package : @augment-vir/common
|
|
7
8
|
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
8
9
|
*/
|
|
9
|
-
export type WrapInTryOptions<FallbackValue> =
|
|
10
|
+
export type WrapInTryOptions<FallbackValue> = RequireOneOrNone<{
|
|
10
11
|
/**
|
|
11
12
|
* Call this function if the callback passed to {@link wrapInTry} throws an error. The thrown
|
|
12
13
|
* error is passed to this function. If a `fallbackValue` option is also provided, it will be
|
|
@@ -29,18 +30,18 @@ export declare function wrapInTry<Value>(callback: NoInputsFunction<Value>, opti
|
|
|
29
30
|
}): Error | Value;
|
|
30
31
|
export declare function wrapInTry<Value extends Promise<any>, FallbackValue = undefined>(callback: NoInputsFunction<Value>, options: {
|
|
31
32
|
handleError: (error: unknown) => FallbackValue;
|
|
32
|
-
fallbackValue?:
|
|
33
|
+
fallbackValue?: never;
|
|
33
34
|
}): Promise<Awaited<FallbackValue> | Awaited<Value>>;
|
|
34
35
|
export declare function wrapInTry<Value, FallbackValue = undefined>(callback: NoInputsFunction<Value>, options: {
|
|
35
36
|
handleError: (error: unknown) => FallbackValue;
|
|
36
|
-
fallbackValue?:
|
|
37
|
+
fallbackValue?: never;
|
|
37
38
|
}): FallbackValue | Value;
|
|
38
39
|
export declare function wrapInTry<Value extends Promise<any>, FallbackValue = undefined>(callback: NoInputsFunction<Value>, options: {
|
|
39
|
-
handleError?:
|
|
40
|
+
handleError?: never;
|
|
40
41
|
fallbackValue: FallbackValue;
|
|
41
42
|
}): Promise<Awaited<FallbackValue> | Awaited<Value>>;
|
|
42
43
|
export declare function wrapInTry<Value, FallbackValue = undefined>(callback: NoInputsFunction<Value>, options: {
|
|
43
|
-
handleError?:
|
|
44
|
+
handleError?: never;
|
|
44
45
|
fallbackValue: FallbackValue;
|
|
45
46
|
}): FallbackValue | Value;
|
|
46
47
|
export declare function wrapInTry<Value extends Promise<any>, FallbackValue = undefined>(callback: NoInputsFunction<Value>, options?: WrapInTryOptions<FallbackValue> | undefined): Promise<FallbackValue | Value | Error>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { check } from '@augment-vir/assert';
|
|
2
|
-
import { ensureError
|
|
2
|
+
import { ensureError } from '@augment-vir/core';
|
|
3
3
|
/**
|
|
4
4
|
* Calls the callback and returns its output. If the callback throws an error, it is handled in the
|
|
5
5
|
* following ways:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/common",
|
|
3
|
-
"version": "31.68.
|
|
3
|
+
"version": "31.68.2",
|
|
4
4
|
"description": "A collection of augments, helpers types, functions, and classes for any JavaScript environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augment",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"test:web": "virmator --no-deps test web"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@augment-vir/assert": "^31.68.
|
|
44
|
-
"@augment-vir/core": "^31.68.
|
|
43
|
+
"@augment-vir/assert": "^31.68.2",
|
|
44
|
+
"@augment-vir/core": "^31.68.2",
|
|
45
45
|
"@date-vir/duration": "^8.2.0",
|
|
46
46
|
"ansi-styles": "^6.2.3",
|
|
47
47
|
"deepcopy-esm": "^2.1.1",
|