From d85dfb2d48fe8b27568ea6d4514d6f2c4c60a126 Mon Sep 17 00:00:00 2001 From: Craig Jellick Date: Thu, 26 Apr 2018 17:10:05 -0700 Subject: [PATCH] make url error logging prettier --- httperror/handler/handler.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/httperror/handler/handler.go b/httperror/handler/handler.go index 8bad04a3..38b02243 100644 --- a/httperror/handler/handler.go +++ b/httperror/handler/handler.go @@ -1,6 +1,8 @@ package handler import ( + "net/url" + "github.com/rancher/norman/httperror" "github.com/rancher/norman/types" "github.com/sirupsen/logrus" @@ -10,8 +12,12 @@ func ErrorHandler(request *types.APIContext, err error) { var error *httperror.APIError if apiError, ok := err.(*httperror.APIError); ok { if apiError.Cause != nil { + url, _ := url.PathUnescape(request.Request.URL.String()) + if url == "" { + url = request.Request.URL.String() + } logrus.Errorf("API error response %v for %v %v. Cause: %v", apiError.Code.Status, request.Request.Method, - request.Request.RequestURI, apiError.Cause) + url, apiError.Cause) } error = apiError } else {