cloudflare-next-intl 0.6.22 → 0.6.24
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.
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Safely converts an `unknown` value (typically `ErrorHandlingParams.error`)
|
|
3
3
|
* into a string, for logging/dedup-keying/display — never throws.
|
|
4
4
|
*
|
|
5
|
-
* @param isClient
|
|
6
|
-
*
|
|
7
|
-
* caught functions client-side isn't safe the way it is on the server.
|
|
5
|
+
* @param isClient Matches `ErrorHandlingParams.isClient`; forwarded to nested
|
|
6
|
+
* `stringifyUnknown` calls when resolving a function-wrapped error.
|
|
8
7
|
* @param isNested Set when stringifying a value nested inside another
|
|
9
8
|
* object/array — falls back to a plain `JSON.stringify` (no pretty-print)
|
|
10
9
|
* so a single unserializable nested value can't crash the whole report.
|
|
@@ -14,16 +14,17 @@ function resolveFunctionError(value) {
|
|
|
14
14
|
return result;
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
|
-
|
|
17
|
+
const message = `Error during function resolution: ${String(error)}`;
|
|
18
|
+
console.warn(message);
|
|
19
|
+
return message;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Safely converts an `unknown` value (typically `ErrorHandlingParams.error`)
|
|
22
24
|
* into a string, for logging/dedup-keying/display — never throws.
|
|
23
25
|
*
|
|
24
|
-
* @param isClient
|
|
25
|
-
*
|
|
26
|
-
* caught functions client-side isn't safe the way it is on the server.
|
|
26
|
+
* @param isClient Matches `ErrorHandlingParams.isClient`; forwarded to nested
|
|
27
|
+
* `stringifyUnknown` calls when resolving a function-wrapped error.
|
|
27
28
|
* @param isNested Set when stringifying a value nested inside another
|
|
28
29
|
* object/array — falls back to a plain `JSON.stringify` (no pretty-print)
|
|
29
30
|
* so a single unserializable nested value can't crash the whole report.
|
|
@@ -34,8 +35,6 @@ export default function stringifyUnknown(value, isClient, isNested = false) {
|
|
|
34
35
|
if (value instanceof Error)
|
|
35
36
|
return stripAnsiCodes(`${value.name}: ${value.message}\n\n${value.stack ?? ''}`);
|
|
36
37
|
if (typeof value === 'function') {
|
|
37
|
-
if (isClient)
|
|
38
|
-
return '[Function]';
|
|
39
38
|
const resolved = resolveFunctionError(value);
|
|
40
39
|
return typeof resolved !== 'function' ? stringifyUnknown(resolved, isClient) : '[Function]';
|
|
41
40
|
}
|