handle errros correctly in the bash tool
This commit is contained in:
parent
80cd75c4fb
commit
9ae05fea12
2 changed files with 6 additions and 2 deletions
|
|
@ -273,14 +273,14 @@ func (b *bashTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
|
|||
},
|
||||
)
|
||||
if !p {
|
||||
return NewTextErrorResponse("permission denied"), nil
|
||||
return ToolResponse{}, permission.ErrorPermissionDenied
|
||||
}
|
||||
}
|
||||
startTime := time.Now()
|
||||
shell := shell.GetPersistentShell(config.WorkingDirectory())
|
||||
stdout, stderr, exitCode, interrupted, err := shell.Exec(ctx, params.Command, params.Timeout)
|
||||
if err != nil {
|
||||
return NewTextErrorResponse(fmt.Sprintf("error executing command: %s", err)), nil
|
||||
return ToolResponse{}, fmt.Errorf("error executing command: %w", err)
|
||||
}
|
||||
took := time.Since(startTime).Milliseconds()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue