fix: printing "undefined" in console in case of plugin throwing a string

Massimo Melina committed Mar 26, 2025 at 22:58 UTC 4f7da939c374b36eba066329d4daef3c07ada1e4
1 file changed +2 -2
src/plugins.ts
+2 -2
@@ -9,7 +9,7 @@ import {
9 import * as Const from './const'
10 import Koa from 'koa'
11 import {
12 - adjustStaticPathForGlob, callable, Callback, CFG, debounceAsync, Dict, objSameKeys, onlyTruthy,
12 + adjustStaticPathForGlob, callable, Callback, CFG, debounceAsync, Dict, objSameKeys, onlyTruthy, prefix,
13 PendingPromise, pendingPromise, Promisable, same, tryJson, wait, waitFor, wantArray, watchDir, objFromKeys, patchKey
14 } from './misc'
15 import * as misc from './misc'
@@ -580,7 +580,7 @@ function watchPlugin(id: string, path: string) {
580 await markItAvailable()
581 const parsed = e.stack?.split('\n\n') // this form is used by syntax-errors inside the plugin, which is useful to show
582 const where = parsed?.length > 1 ? `\n${parsed[0]}` : ''
583 - e = e.message + where || String(e)
583 + e = prefix('', e.message, where) || String(e)
584 setError(id, e)
585 }
586 finally {