Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
HTTPError Error() return when Cause is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
saurori authored and paganotoni committed Apr 19, 2022
1 parent 5db1cc0 commit 34f4574
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ func (h HTTPError) Unwrap() error {

// Error returns the cause of the error as string.
func (h HTTPError) Error() string {
return fmt.Sprint(h.Cause)
if h.Cause != nil {
return h.Cause.Error()
}
return "unknown cause"
}

// ErrorHandler interface for handling an error for a
Expand Down

0 comments on commit 34f4574

Please sign in to comment.