fix: bunproc stdout / stderr parsing, error handling for bun ResolveMessage (#468)

This commit is contained in:
Wendell Misiedjan
2025-06-27 20:09:35 +02:00
committed by GitHub
parent e0553b8d2c
commit 3cfd9d80bc
2 changed files with 19 additions and 7 deletions

View File

@@ -67,19 +67,32 @@ const cli = yargs(hideBin(process.argv))
try {
await cli.parse()
} catch (e) {
const data: Record<string, any> = {}
let data: Record<string, any> = {}
if (e instanceof NamedError) {
const obj = e.toObject()
Object.assign(data, {
...obj.data,
})
}
if (e instanceof Error) {
Object.assign(data, {
name: e.name,
message: e.message,
cause: e.cause?.toString(),
})
}
if (e instanceof ResolveMessage) {
Object.assign(data, {
name: e.name,
message: e.message,
code: e.code,
specifier: e.specifier,
referrer: e.referrer,
position: e.position,
importKind: e.importKind,
});
}
Log.Default.error("fatal", data)
const formatted = FormatError(e)