Skip to content

Commit

Permalink
Merge pull request #2799 from ActiveState/DX-2258
Browse files Browse the repository at this point in the history
  • Loading branch information
Naatan authored Oct 10, 2023
2 parents 891e2d2 + 279e97d commit 2d1f9f1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/cmdlets/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ func (o *OutputError) MarshalOutput(f output.Format) interface{} {
}

func (o *OutputError) MarshalStructured(f output.Format) interface{} {
return output.StructuredError{locale.JoinedErrorMessage(o.error)}
var userFacingError errs.UserFacingError
var message string
if errors.As(o.error, &userFacingError) {
message = userFacingError.UserError()
} else {
message = locale.JoinedErrorMessage(o.error)
}
return output.StructuredError{message}
}

func trimError(msg string) string {
Expand Down

0 comments on commit 2d1f9f1

Please sign in to comment.