Skip to content

Commit 044c63a

Browse files
authored
fix: improve weval and wizer error reporting (#333)
1 parent c34a8af commit 044c63a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/componentize.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ export async function componentize(
281281
}
282282

283283
let postProcess;
284+
let postProcessName;
284285
if (opts.enableAot) {
285286
// Determine the weval bin path, possibly using a pre-downloaded version
286287
let wevalBin;
@@ -302,6 +303,7 @@ export async function componentize(
302303
env.RUST_MIN_STACK = defaultMinStackSize();
303304
}
304305

306+
postProcessName = `weval (${wevalBin})`;
305307
postProcess = spawnSync(
306308
wevalBin,
307309
[
@@ -323,6 +325,7 @@ export async function componentize(
323325
);
324326
} else {
325327
const wizerBin = opts.wizerBin ?? wizer;
328+
postProcessName = `wizer (${wizerBin})`;
326329
postProcess = spawnSync(
327330
wizerBin,
328331
[
@@ -345,9 +348,15 @@ export async function componentize(
345348
}
346349

347350
// If the wizer (or weval) process failed, parse the output and display to the user
348-
if (postProcess.status !== 0) {
349-
let wizerErr = parseWizerStderr(postProcess.stderr);
350-
let err = `Failed to initialize component:\n${wizerErr}`;
351+
if (postProcess.status !== 0 || postProcess.signal) {
352+
let procErr = parseWizerStderr(postProcess.stderr);
353+
if (postProcess.signal) {
354+
procErr += `\nProcess was killed by signal: ${postProcess.signal}`;
355+
}
356+
if (postProcess.error) {
357+
procErr += `\nProcess error: ${postProcess.error.message}`;
358+
}
359+
let err = `Failed to initialize component (${postProcessName}):\n${procErr}`;
351360
if (debugBindings) {
352361
err += `\n\nBinary and sources available for debugging at ${workDir}\n`;
353362
} else {

0 commit comments

Comments
 (0)