Buckets:
| import { getDigestForWellKnownError } from './create-error-handler' | |
| import { isReactLargeShellError } from './react-large-shell-error' | |
| export enum Phase { | |
| ProspectiveRender = 'the prospective render', | |
| SegmentCollection = 'segment collection', | |
| InstantValidation = 'instant validation', | |
| } | |
| export function printDebugThrownValueForProspectiveRender( | |
| thrownValue: unknown, | |
| route: string, | |
| phase: Phase | |
| ) { | |
| // We don't need to print well-known Next.js errors. | |
| if (getDigestForWellKnownError(thrownValue)) { | |
| return | |
| } | |
| if (isReactLargeShellError(thrownValue)) { | |
| // TODO: Aggregate | |
| console.error(thrownValue) | |
| return undefined | |
| } | |
| let message: undefined | string | |
| if ( | |
| typeof thrownValue === 'object' && | |
| thrownValue !== null && | |
| typeof (thrownValue as any).message === 'string' | |
| ) { | |
| message = (thrownValue as any).message | |
| if (typeof (thrownValue as any).stack === 'string') { | |
| const originalErrorStack: string = (thrownValue as any).stack | |
| const stackStart = originalErrorStack.indexOf('\n') | |
| if (stackStart > -1) { | |
| const error = new Error( | |
| `Route ${route} errored during ${phase}. These errors are normally ignored and may not prevent the route from prerendering but are logged here because build debugging is enabled. | |
| Original Error: ${message}` | |
| ) | |
| error.stack = | |
| 'Error: ' + error.message + originalErrorStack.slice(stackStart) | |
| console.error(error) | |
| return | |
| } | |
| } | |
| } else if (typeof thrownValue === 'string') { | |
| message = thrownValue | |
| } | |
| if (message) { | |
| console.error(`Route ${route} errored during ${phase}. These errors are normally ignored and may not prevent the route from prerendering but are logged here because build debugging is enabled. No stack was provided. | |
| Original Message: ${message}`) | |
| return | |
| } | |
| console.error( | |
| `Route ${route} errored during ${phase}. These errors are normally ignored and may not prevent the route from prerendering but are logged here because build debugging is enabled. The thrown value is logged just following this message` | |
| ) | |
| console.error(thrownValue) | |
| return | |
| } | |
Xet Storage Details
- Size:
- 2.18 kB
- Xet hash:
- 779867eac3da9f384c68ca1232506ba652297a8d8b78125ebaf815dcf69981f7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.