cloudflare-next-intl 0.8.50 → 0.8.51
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.
|
@@ -77,15 +77,29 @@ export default function installConsoleErrorOverride(config, isClient) {
|
|
|
77
77
|
consoleOverrideState.active = true;
|
|
78
78
|
const suppressOnClient = isClient === true && config.errorHandling?.suppressClientConsoleError === true;
|
|
79
79
|
const override = (message, ...optionalParams) => {
|
|
80
|
+
const isEmptyCall = message === undefined && optionalParams.length === 0;
|
|
81
|
+
// React's own `onCaughtError` fallback logs a caught value with a
|
|
82
|
+
// plain `console.error(value)` — a component that throws `undefined`
|
|
83
|
+
// therefore reaches here as an argument-less call carrying no
|
|
84
|
+
// provenance at all. The stack below this override is the only
|
|
85
|
+
// remaining pointer to which subtree threw, so it goes to BOTH the
|
|
86
|
+
// console line and the report; without it the report says nothing
|
|
87
|
+
// but "undefined".
|
|
88
|
+
const stack = isEmptyCall ? callerStack() : '';
|
|
80
89
|
if (!suppressOnClient) {
|
|
81
|
-
if (
|
|
82
|
-
originalConsoleError(`${EMPTY_CONSOLE_ERROR_MESSAGE}${
|
|
90
|
+
if (isEmptyCall) {
|
|
91
|
+
originalConsoleError(`${EMPTY_CONSOLE_ERROR_MESSAGE}${stack}`);
|
|
83
92
|
}
|
|
84
93
|
else {
|
|
85
94
|
originalConsoleError(message, ...optionalParams);
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
|
-
void reportError(config, {
|
|
97
|
+
void reportError(config, {
|
|
98
|
+
error: message,
|
|
99
|
+
classOrMethodName: 'Global Console Error Handler',
|
|
100
|
+
params: isEmptyCall ? [`${EMPTY_CONSOLE_ERROR_MESSAGE}${stack}`] : optionalParams,
|
|
101
|
+
isClient,
|
|
102
|
+
});
|
|
89
103
|
};
|
|
90
104
|
override.__isErrorHandlingOverride = true;
|
|
91
105
|
console.error = override;
|