cloudflare-next-intl 0.6.1 → 0.6.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.
|
@@ -28,6 +28,12 @@ export interface ReportErrorConfig {
|
|
|
28
28
|
* `onError` directly when `getCloudflareContext`/`ctx.waitUntil` is unset or
|
|
29
29
|
* unavailable (e.g. outside a Cloudflare Worker).
|
|
30
30
|
*
|
|
31
|
+
* Passing `params.error` as `null`/`undefined` with `errorHandling.resetDedup: true`
|
|
32
|
+
* and nothing else is a valid "reset-only" call: the dedup state clears and
|
|
33
|
+
* `reportError` returns immediately, without calling `onError` — useful to
|
|
34
|
+
* clear dedup state once at the very start of a request/cron tick, before
|
|
35
|
+
* any handler that might call `reportError` for a real error runs.
|
|
36
|
+
*
|
|
31
37
|
* @param config Pass the relevant slices of your `RoutingConfig` directly —
|
|
32
38
|
* `{ errorHandling: config.errorHandling, generate: config.generate }`.
|
|
33
39
|
*/
|
|
@@ -50,6 +50,12 @@ async function callOnError(config, params) {
|
|
|
50
50
|
* `onError` directly when `getCloudflareContext`/`ctx.waitUntil` is unset or
|
|
51
51
|
* unavailable (e.g. outside a Cloudflare Worker).
|
|
52
52
|
*
|
|
53
|
+
* Passing `params.error` as `null`/`undefined` with `errorHandling.resetDedup: true`
|
|
54
|
+
* and nothing else is a valid "reset-only" call: the dedup state clears and
|
|
55
|
+
* `reportError` returns immediately, without calling `onError` — useful to
|
|
56
|
+
* clear dedup state once at the very start of a request/cron tick, before
|
|
57
|
+
* any handler that might call `reportError` for a real error runs.
|
|
58
|
+
*
|
|
53
59
|
* @param config Pass the relevant slices of your `RoutingConfig` directly —
|
|
54
60
|
* `{ errorHandling: config.errorHandling, generate: config.generate }`.
|
|
55
61
|
*/
|
|
@@ -58,6 +64,8 @@ export default async function reportError(config, params) {
|
|
|
58
64
|
if (errorHandling?.resetDedup) {
|
|
59
65
|
lastDedupKey = null;
|
|
60
66
|
lastReportedAt = 0;
|
|
67
|
+
if (params.error === null || params.error === undefined)
|
|
68
|
+
return;
|
|
61
69
|
}
|
|
62
70
|
if (errorHandling?.enable === false)
|
|
63
71
|
return;
|