Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: log error cause #56528

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/next/src/server/dev/log-app-dir-error.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import isError from '../../lib/is-error'
import * as Log from '../../build/output/log'

export function logAppDirError(err: any) {
export function logAppDirError(err: unknown) {
if (isError(err) && err?.stack) {
const cleanedStack = err.stack.split('\n').map((line: string) =>
// Remove 'webpack-internal:' noise from the path
Expand All @@ -24,6 +24,8 @@ export function logAppDirError(err: any) {
if (typeof (err as any).digest !== 'undefined') {
console.error(`digest: ${JSON.stringify((err as any).digest)}`)
}

if (err.cause) console.error('Cause:', err.cause)
} else {
Log.error(err)
}
Expand Down
Loading