rename recover
This commit is contained in:
parent
72a34dcdf2
commit
314090d649
1 changed files with 4 additions and 4 deletions
|
|
@ -85,18 +85,18 @@ func (r *ToolRegistry) ExecuteWithContext(
|
||||||
var result *ToolResult
|
var result *ToolResult
|
||||||
func() {
|
func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if re := recover(); re != nil {
|
||||||
errMsg := fmt.Sprintf("Tool '%s' crashed with panic: %v", name, r)
|
errMsg := fmt.Sprintf("Tool '%s' crashed with panic: %v", name, re)
|
||||||
logger.ErrorCF("tool", "Tool execution panic recovered",
|
logger.ErrorCF("tool", "Tool execution panic recovered",
|
||||||
map[string]any{
|
map[string]any{
|
||||||
"tool": name,
|
"tool": name,
|
||||||
"panic": fmt.Sprintf("%v", r),
|
"panic": fmt.Sprintf("%v", re),
|
||||||
})
|
})
|
||||||
result = &ToolResult{
|
result = &ToolResult{
|
||||||
ForLLM: errMsg,
|
ForLLM: errMsg,
|
||||||
ForUser: errMsg,
|
ForUser: errMsg,
|
||||||
IsError: true,
|
IsError: true,
|
||||||
Err: fmt.Errorf("panic: %v", r),
|
Err: fmt.Errorf("panic: %v", re),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue