Merge pull request #3060 from chengzhichao-xydt/codex/error-wrap-and-marshal

fix: use %w for error wrapping and handle json.MarshalIndent error
This commit is contained in:
Mauro 2026-06-11 18:36:55 +02:00 committed by GitHub
commit fa6ed714c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -79,7 +79,7 @@ func skillsInstallFromRegistry(cfg *config.Config, registryName, target string)
defer cancel() defer cancel()
if err = os.MkdirAll(filepath.Join(workspace, "skills"), 0o755); err != nil { if err = os.MkdirAll(filepath.Join(workspace, "skills"), 0o755); err != nil {
return fmt.Errorf("\u2717 failed to create skills directory: %v", err) return fmt.Errorf("\u2717 failed to create skills directory: %w", err)
} }
result, err := registry.DownloadAndInstall(ctx, target, "", targetDir) result, err := registry.DownloadAndInstall(ctx, target, "", targetDir)

View file

@ -2275,7 +2275,10 @@ func (t *WebFetchTool) Execute(ctx context.Context, args map[string]any) *ToolRe
"text": text, "text": text,
} }
resultJSON, _ := json.MarshalIndent(result, "", " ") resultJSON, marshalErr := json.MarshalIndent(result, "", " ")
if marshalErr != nil {
return ErrorResult(fmt.Sprintf("failed to marshal result: %v", marshalErr))
}
return &ToolResult{ return &ToolResult{
ForLLM: string(resultJSON), ForLLM: string(resultJSON),