tweak: better agent create error handling (#2058)

This commit is contained in:
Aiden Cline
2025-08-19 00:14:50 -05:00
committed by GitHub
parent 50fb337270
commit c0f90eb564
2 changed files with 5 additions and 2 deletions

View File

@@ -46,7 +46,10 @@ const AgentCreateCommand = cmd({
const spinner = prompts.spinner()
spinner.start("Generating agent configuration...")
const generated = await Agent.generate({ description: query })
const generated = await Agent.generate({ description: query }).catch((error) => {
spinner.stop(`LLM failed to generate agent: ${error.message}`, 1)
throw new UI.CancelledError()
})
spinner.stop(`Agent ${generated.identifier} generated`)
const availableTools = [

View File

@@ -45,7 +45,7 @@ export const UpgradeCommand = {
spinner.start("Upgrading...")
const err = await Installation.upgrade(method, target).catch((err) => err)
if (err) {
spinner.stop("Upgrade failed")
spinner.stop("Upgrade failed", 1)
if (err instanceof Installation.UpgradeFailedError) prompts.log.error(err.data.stderr)
else if (err instanceof Error) prompts.log.error(err.message)
prompts.outro("Done")