From 15bfe27168a7d4839d76f372a9076ca8fc2d7d34 Mon Sep 17 00:00:00 2001 From: Jeffrey Chen Date: Thu, 26 Feb 2026 00:56:08 +0000 Subject: [PATCH] Fix issue with error not being printed --- cli/azd/pkg/azdext/extension_error.go | 6 +++++- cli/azd/pkg/azdext/extension_error_test.go | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cli/azd/pkg/azdext/extension_error.go b/cli/azd/pkg/azdext/extension_error.go index 5c61a00ea5b..1cfb0771321 100644 --- a/cli/azd/pkg/azdext/extension_error.go +++ b/cli/azd/pkg/azdext/extension_error.go @@ -155,5 +155,9 @@ func UnwrapError(msg *ExtensionError) error { } } - return errors.New(msg.GetMessage()) + return &LocalError{ + Message: msg.GetMessage(), + Category: LocalErrorCategoryLocal, + Suggestion: msg.GetSuggestion(), + } } diff --git a/cli/azd/pkg/azdext/extension_error_test.go b/cli/azd/pkg/azdext/extension_error_test.go index 12c7f95ffba..228d33eae6c 100644 --- a/cli/azd/pkg/azdext/extension_error_test.go +++ b/cli/azd/pkg/azdext/extension_error_test.go @@ -33,6 +33,13 @@ func TestExtensionError_RoundTrip(t *testing.T) { assert.Nil(t, protoErr.GetSource()) assert.Equal(t, "simple error", goErr.Error()) + + // Untyped errors round-trip as LocalError so the message is preserved + // through the display and telemetry pipelines. + var localErr *LocalError + require.ErrorAs(t, goErr, &localErr) + assert.Equal(t, "simple error", localErr.Message) + assert.Equal(t, LocalErrorCategoryLocal, localErr.Category) }, }, {