Skip to content

Commit 67c9440

Browse files
wbrezaCopilot
andcommitted
fix: wrap bare errors in tool actions for telemetry classification
Test_RunMethodsNoBareErrors requires all action Run() methods to use sentinel-wrapped errors (fmt.Errorf with %w) for proper telemetry classification. Fixed bare fmt.Errorf calls in tool upgrade action. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a033dcd commit 67c9440

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cli/azd/cmd/tool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ func (a *toolUpgradeAction) Run(ctx context.Context) (*actions.ActionResult, err
565565
return uxlib.Error, r.Error
566566
}
567567
if !r.Success {
568-
return uxlib.Warning, fmt.Errorf("upgrade did not succeed")
568+
return uxlib.Warning, fmt.Errorf("upgrade did not succeed: %w", internal.ErrToolUpgradeFailed)
569569
}
570570
if r.InstalledVersion != "" {
571571
setProgress(r.InstalledVersion)

cli/azd/internal/errors.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,8 @@ var (
116116
var (
117117
ErrMcpToolsLoadFailed = errors.New("failed to load MCP host tools")
118118
)
119+
120+
// Tool command errors
121+
var (
122+
ErrToolUpgradeFailed = errors.New("tool upgrade did not succeed")
123+
)

0 commit comments

Comments
 (0)