Skip to content

Commit

Permalink
add details in APIError.Error
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Jan 17, 2024
1 parent 19b8bfa commit 8473a83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kong/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func NewAPIErrorWithRaw(code int, msg string, raw []byte) *APIError {
}

func (e *APIError) Error() string {
return fmt.Sprintf("HTTP status %d (message: %q)", e.httpCode, e.message)
if e.details == nil {
return fmt.Sprintf("HTTP status %d (message: %q)", e.httpCode, e.message)
}
return fmt.Sprintf("HTTP status %d (message: %q; details: %v)", e.httpCode, e.message, e.details)
}

// Code returns the HTTP status code for the error.
Expand Down

0 comments on commit 8473a83

Please sign in to comment.