mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
tweak: make zod error more prompty
This commit is contained in:
parent
0d608f6014
commit
edc933d816
1 changed files with 5 additions and 2 deletions
|
|
@ -50,9 +50,12 @@ export namespace Tool {
|
|||
toolInfo.parameters.parse(args)
|
||||
} catch (error) {
|
||||
if (error instanceof z.ZodError && toolInfo.formatValidationError) {
|
||||
throw new Error(toolInfo.formatValidationError(error))
|
||||
throw new Error(toolInfo.formatValidationError(error), { cause: error })
|
||||
}
|
||||
throw error
|
||||
throw new Error(
|
||||
`The ${id} tool was called with invalid arguments: ${error}.\nPlease rewrite the input so it satisfies the expected schema.`,
|
||||
{ cause: error },
|
||||
)
|
||||
}
|
||||
return execute(args, ctx)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue