mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix: add friendly error messages for failed binary spawning
Added helpful error messages with cause preservation when spawning codex, gemini, or other CLI tools fails because the binary is not found in PATH. This follows the existing error handling pattern from claudeLocal.ts.
This commit is contained in:
@@ -65,7 +65,11 @@ export class AcpStdioTransport {
|
||||
|
||||
this.process.on('error', (error) => {
|
||||
logger.debug('[ACP] Process error', error);
|
||||
this.rejectAllPending(error instanceof Error ? error : new Error(String(error)));
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
this.rejectAllPending(new Error(
|
||||
`Failed to spawn ${options.command}: ${message}. Is it installed and on PATH?`,
|
||||
{ cause: error }
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,8 @@ export async function codexLocal(opts: {
|
||||
|
||||
child.on('error', (error) => {
|
||||
cleanupAbortHandler();
|
||||
reject(error);
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
reject(new Error(`Failed to spawn codex: ${message}. Is Codex CLI installed and on PATH?`, { cause: error }));
|
||||
});
|
||||
|
||||
child.on('exit', (code, signal) => {
|
||||
|
||||
Reference in New Issue
Block a user