@envelop/core 3.0.1 → 3.0.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.
|
@@ -50,7 +50,7 @@ const makeHandleResult = (maskError, message) => ({ result, setResult }) => {
|
|
|
50
50
|
setResult({ ...result, errors: result.errors.map(error => maskError(error, message)) });
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
function useMaskedErrors(opts) {
|
|
54
54
|
const maskError = opts?.maskError ?? exports.defaultMaskError;
|
|
55
55
|
const message = opts?.errorMessage || exports.DEFAULT_ERROR_MESSAGE;
|
|
56
56
|
const handleResult = makeHandleResult(maskError, message);
|
|
@@ -78,5 +78,5 @@ const useMaskedErrors = (opts) => {
|
|
|
78
78
|
};
|
|
79
79
|
},
|
|
80
80
|
};
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
82
|
exports.useMaskedErrors = useMaskedErrors;
|
|
@@ -45,7 +45,7 @@ const makeHandleResult = (maskError, message) => ({ result, setResult }) => {
|
|
|
45
45
|
setResult({ ...result, errors: result.errors.map(error => maskError(error, message)) });
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export function useMaskedErrors(opts) {
|
|
49
49
|
const maskError = opts?.maskError ?? defaultMaskError;
|
|
50
50
|
const message = opts?.errorMessage || DEFAULT_ERROR_MESSAGE;
|
|
51
51
|
const handleResult = makeHandleResult(maskError, message);
|
|
@@ -73,4 +73,4 @@ export const useMaskedErrors = (opts) => {
|
|
|
73
73
|
};
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
|
-
}
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -19,4 +19,4 @@ export declare type UseMaskedErrorsOpts = {
|
|
|
19
19
|
/** The error message that shall be used for masked errors. */
|
|
20
20
|
errorMessage?: string;
|
|
21
21
|
};
|
|
22
|
-
export declare
|
|
22
|
+
export declare function useMaskedErrors<PluginContext extends Record<string, any> = {}>(opts?: UseMaskedErrorsOpts): Plugin<PluginContext>;
|
|
@@ -19,4 +19,4 @@ export declare type UseMaskedErrorsOpts = {
|
|
|
19
19
|
/** The error message that shall be used for masked errors. */
|
|
20
20
|
errorMessage?: string;
|
|
21
21
|
};
|
|
22
|
-
export declare
|
|
22
|
+
export declare function useMaskedErrors<PluginContext extends Record<string, any> = {}>(opts?: UseMaskedErrorsOpts): Plugin<PluginContext>;
|