Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changesets/1794524968-fc46a4a4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
id: 1794524968-fc46a4a4
features:
- errors
targets:
- go
type: fix
bump: patch
description: prefix inferred Go error messages with the error code and fall back when the message is empty
author: TristanSpeakEasy
date: "2026-11-13"
12 changes: 8 additions & 4 deletions pkg/generate/snapshots/error_field_collision_go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ func (u GatewayTimeout) Error() string {
switch u.Type {
case GatewayTimeoutTypeError:
if u.ErrorInfo != nil {
return u.ErrorInfo.Message
if u.ErrorInfo.Message != "" {
return u.ErrorInfo.Message
}
}

data, _ := json.Marshal(u.ErrorInfo)
Expand Down Expand Up @@ -430,7 +432,9 @@ func (u ServiceUnavailable) Error() string {
switch u.Type {
case ServiceUnavailableTypeAlpha:
if u.AlphaError != nil {
return u.AlphaError.Message
if u.AlphaError.Message != "" {
return u.AlphaError.Message
}
}

data, _ := json.Marshal(u.AlphaError)
Expand Down Expand Up @@ -459,7 +463,7 @@ var _ error = &BadGatewayError{}

func (e *BadGatewayError) Error() string {
if e != nil {
if e.Error_.Message != nil {
if e.Error_.Message != nil && *e.Error_.Message != "" {
return *e.Error_.Message
}
}
Expand All @@ -478,7 +482,7 @@ var _ error = &InternalServerError{}

func (e *InternalServerError) Error() string {
if e != nil {
if e.ErrorInfo.Message != nil {
if e.ErrorInfo.Message != nil && *e.ErrorInfo.Message != "" {
return *e.ErrorInfo.Message
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var _ error = &ConflictError{}
func (e *ConflictError) Error() string {
if e != nil {
if v0 := e.ErrorInfo; v0 != nil {
if v0.GetMessage() != nil {
if v0.GetMessage() != nil && *v0.GetMessage() != "" {
return *v0.GetMessage()
}
}
Expand Down Expand Up @@ -402,7 +402,9 @@ func (u BadRequest) Error() string {
switch u.Type {
case BadRequestTypeFailure:
if u.WidgetFailure != nil {
return u.WidgetFailure.Error.Message
if u.WidgetFailure.Error.Message != "" {
return u.WidgetFailure.Error.Message
}
}

data, _ := json.Marshal(u.WidgetFailure)
Expand Down
Loading
Loading