From 34f457472e8fd7a317291684836bd0c58924878a Mon Sep 17 00:00:00 2001 From: Stefan Aurori Date: Sat, 16 Apr 2022 11:00:02 -0400 Subject: [PATCH] HTTPError Error() return when Cause is nil --- errors.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/errors.go b/errors.go index fc764861e..228bd3865 100644 --- a/errors.go +++ b/errors.go @@ -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