Skip to content

Commit 88b3975

Browse files
bteasheremet-va
authored andcommitted
fix(node): guard error info
1 parent ed4e042 commit 88b3975

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/vitest/src/node/error.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ export function displayDiff(diff: string | null, console: Console) {
191191

192192
function printErrorMessage(error: ErrorWithDiff, logger: Logger) {
193193
const errorName = error.name || error.nameStr || 'Unknown Error'
194+
if (!(error instanceof Error)) {
195+
logger.error(error)
196+
return
197+
}
194198
if (error.message.length > 5000) {
195199
// Protect against infinite stack trace in picocolors
196200
logger.error(`${c.red(c.bold(errorName))}: ${error.message}`)

0 commit comments

Comments
 (0)