hatch-surf/node_modules/next/dist/esm/lib/is-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

56 lines
2.2 KiB
JavaScript

import { isPlainObject } from '../shared/lib/is-plain-object';
/**
* This is a safe stringify function that handles circular references.
* We're using a simpler version here to avoid introducing
* the dependency `safe-stable-stringify` into production bundle.
*
* This helper is used both in development and production.
*/ function safeStringifyLite(obj) {
const seen = new WeakSet();
return JSON.stringify(obj, (_key, value)=>{
// If value is an object and already seen, replace with "[Circular]"
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return '[Circular]';
}
seen.add(value);
}
return value;
});
}
/**
* Checks whether the given value is a NextError.
* This can be used to print a more detailed error message with properties like `code` & `digest`.
*/ export default function isError(err) {
return typeof err === 'object' && err !== null && 'name' in err && 'message' in err;
}
export function getProperError(err) {
if (isError(err)) {
return err;
}
if (process.env.NODE_ENV === 'development') {
// provide better error for case where `throw undefined`
// is called in development
if (typeof err === 'undefined') {
return Object.defineProperty(new Error('An undefined error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
value: "E98",
enumerable: false,
configurable: true
});
}
if (err === null) {
return Object.defineProperty(new Error('A null error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'), "__NEXT_ERROR_CODE", {
value: "E336",
enumerable: false,
configurable: true
});
}
}
return Object.defineProperty(new Error(isPlainObject(err) ? safeStringifyLite(err) : err + ''), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
}
//# sourceMappingURL=is-error.js.map