From cacd976a0ccc9d330f2b093220e0028fd48e38eb Mon Sep 17 00:00:00 2001 From: Liu Shuang Date: Mon, 1 May 2023 05:18:43 +0800 Subject: [PATCH] feat: RequestError print status code (#285) --- error.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/error.go b/error.go index 8aee670..86b75f4 100644 --- a/error.go +++ b/error.go @@ -70,10 +70,7 @@ func (e *APIError) UnmarshalJSON(data []byte) (err error) { } func (e *RequestError) Error() string { - if e.Err != nil { - return e.Err.Error() - } - return fmt.Sprintf("status code %d", e.HTTPStatusCode) + return fmt.Sprintf("status code %d, message: %s", e.HTTPStatusCode, e.Err) } func (e *RequestError) Unwrap() error {