From 67672373f4303c50db84af723c8b43f1f71701e6 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Mon, 24 Dec 2018 09:30:33 +0800 Subject: [PATCH] Expose the real error message of BadRequest error This change exposes the error message of BadRequest error from API, which is helpful to find out the real error reason. --- errors.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/errors.go b/errors.go index d358c68eb..d72718f2d 100644 --- a/errors.go +++ b/errors.go @@ -108,7 +108,11 @@ type ErrDefault503 struct { } func (e ErrDefault400) Error() string { - return "Invalid request due to incorrect syntax or missing required parameters." + e.DefaultErrString = fmt.Sprintf( + "Bad request with: [%s %s], error message: %s", + e.Method, e.URL, e.Body, + ) + return e.choseErrString() } func (e ErrDefault401) Error() string { return "Authentication failed"