hatch-surf/node_modules/next/dist/esm/client/react-client-callbacks/on-recoverable-error.js
Riley Zhang df378d33ef
Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Merge GitHub main into Gitea repo (allow unrelated histories)
Resolved conflicts by taking GitHub versions for:
- .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml

Kept deploy.sh updated to:
- Pull from GitHub (primary source)
- Push to Gitea (push-mirror)
- Build from site/ directory (GitHub structure)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-25 05:20:46 +02:00

37 lines
1.8 KiB
JavaScript

// This module can be shared between both pages router and app router
import { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr';
import isError from '../../lib/is-error';
import { reportGlobalError } from './report-global-error';
const recoverableErrors = new WeakSet();
const isInstantTest = process.env.__NEXT_EXPOSE_TESTING_API && typeof self !== 'undefined' && !!self.__next_instant_test;
export function isRecoverableError(error) {
return recoverableErrors.has(error);
}
export const onRecoverableError = (error)=>{
// x-ref: https://github.com/facebook/react/pull/28736
let cause = isError(error) && 'cause' in error ? error.cause : error;
// Skip certain custom errors which are not expected to be reported on client
if (isBailoutToCSRError(cause)) return;
// Instant Navigation Testing API: suppress "server could not finish this
// Suspense boundary" errors (React error #419) during instant test mode.
// The static shell intentionally has incomplete Suspense boundaries — React
// correctly falls back to client rendering, which is expected.
if (isInstantTest) {
if (isError(cause)) {
if (process.env.NODE_ENV === 'production') {
if (cause.message.includes('#419')) return;
} else {
if (cause.message.includes('could not finish this Suspense boundary')) return;
}
}
}
if (process.env.NODE_ENV !== 'production') {
const { decorateDevError } = require('../../next-devtools/userspace/app/errors/stitched-error');
const causeError = decorateDevError(cause);
recoverableErrors.add(causeError);
cause = causeError;
}
reportGlobalError(cause);
};
//# sourceMappingURL=on-recoverable-error.js.map