Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 16, 2022
1 parent 2279bc3 commit c8bf713
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/vite/src/runtime/vite-node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ function createRunner () {
message,
stack
})
} catch (err) {
// This should not happen unless there is an internal error with formatViteError!
consola.error('Internal error while formatting error for transformating', id, errorData)
} catch (formatError) {
consola.warn('Internal nuxt error while formatting vite-node error. Please report this!', formatError)
const message = `[vite-node] [TransformError] ${errorData?.message || '-'}`
consola.error(message, errorData)
throw createError({
statusMessage: 'Vite Error',
message: errorData.message || 'Vite Error',
stack: `Internal error while formatting error\nat ${id} [check console]`
message,
stack: `${message}\nat ${id}\n` + (errorData?.stack || '')
})
}
throw _err
Expand All @@ -64,7 +65,7 @@ function createRunner () {
}

function formatViteError (errorData) {
const errorCode = errorData.foo.name || errorData.reasonCode || errorData.code
const errorCode = errorData.name || errorData.reasonCode || errorData.code
const frame = errorData.frame || errorData.source || errorData.pluginCode

const getLocId = (locObj = {}) => locObj.file || locObj.id || locObj.url || ''
Expand Down

0 comments on commit c8bf713

Please sign in to comment.