fix(vite): include id and stack in vite-node fallback error handler (#7575)

Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
Daniel Roe 2022-09-16 19:12:52 +01:00 committed by GitHub
parent cfaca9c5c7
commit 5bc654495a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,13 +48,14 @@ function createRunner () {
message, message,
stack stack
}) })
} catch (err) { } catch (formatError) {
// This should not happen unless there is an internal error with formatViteError! consola.warn('Internal nuxt error while formatting vite-node error. Please report this!', formatError)
consola.error('Error while formatting vite error:', errorData) const message = `[vite-node] [TransformError] ${errorData?.message || '-'}`
consola.error(message, errorData)
throw createError({ throw createError({
statusMessage: 'Vite Error', statusMessage: 'Vite Error',
message: errorData.message || 'Vite Error', message,
stack: 'Vite Error\nat [check console]' stack: `${message}\nat ${id}\n` + (errorData?.stack || '')
}) })
} }
throw _err throw _err