Browse code

api: Don't include stack traces with errors

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>

Aaron Lehmann authored on 2017/04/06 08:59:32
Showing 1 changed files
... ...
@@ -139,11 +139,9 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
139 139
 
140 140
 		if err := handlerFunc(ctx, w, r, vars); err != nil {
141 141
 			statusCode := httputils.GetHTTPErrorStatusCode(err)
142
-			errFormat := "%v"
143
-			if statusCode == http.StatusInternalServerError {
144
-				errFormat = "%+v"
142
+			if statusCode >= 500 {
143
+				logrus.Errorf("Handler for %s %s returned error: %v", r.Method, r.URL.Path, err)
145 144
 			}
146
-			logrus.Errorf("Handler for %s %s returned error: "+errFormat, r.Method, r.URL.Path, err)
147 145
 			httputils.MakeErrorHandler(err)(w, r)
148 146
 		}
149 147
 	}