fix(seahorse): handle json.Marshal errors in grep and expand tools
This commit is contained in:
1 parent
cf67dd3851
commit
ed55715b6b
2 files changed
+8
-2
No files matched your search
@@ -124,6 +124,9 @@ func (t *ExpandTool) Execute(ctx context.Context, args map[string]any) *tools.To
|
||||
"tokenCount": result.TokenCount,
|
||||
"messages": messages,
|
||||
}
|
||||
data, _ := json.Marshal(output)
|
||||
data, err := json.Marshal(output)
|
||||
if err != nil {
|
||||
return tools.ErrorResult(fmt.Sprintf("failed to marshal expand result: %v", err))
|
||||
}
|
||||
return tools.NewToolResult(string(data))
|
||||
}
|
||||
@@ -167,6 +167,9 @@ func (t *GrepTool) Execute(ctx context.Context, args map[string]any) *tools.Tool
|
||||
output["hint"] = result.Hint
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(output)
|
||||
data, err := json.Marshal(output)
|
||||
if err != nil {
|
||||
return tools.ErrorResult(fmt.Sprintf("failed to marshal grep result: %v", err))
|
||||
}
|
||||
return tools.NewToolResult(string(data))
|
||||
}
|
||||
Reference in new issue
Block a user