Commit 6fca6fbb authored by Kamil Trzcinski's avatar Kamil Trzcinski

Use request entity too large and proxy request in case of error

parent c0cde5db
......@@ -95,7 +95,7 @@ func RegisterHandler(h http.Handler, watchHandler WatchKeyHandler, pollingDurati
requestBody, err := readRunnerBody(w, r)
if err != nil {
registerHandlerHits.WithLabelValues("body-read-error").Inc()
helper.Fail500(w, r, &largeBodyError{err})
helper.RequestEntityTooLarge(w, r, &largeBodyError{err})
return
}
......@@ -118,7 +118,7 @@ func RegisterHandler(h http.Handler, watchHandler WatchKeyHandler, pollingDurati
runnerRequest.LastUpdate, pollingDuration)
if err != nil {
registerHandlerHits.WithLabelValues("watch-error").Inc()
helper.Fail500(w, newRequest, &watchError{err})
proxyRegisterRequest(h, w, newRequest)
return
}
......
......@@ -41,6 +41,12 @@ func TooManyRequests(w http.ResponseWriter, r *http.Request, err error) {
printError(r, err)
}
func RequestEntityTooLarge(w http.ResponseWriter, r *http.Request, err error) {
http.Error(w, "Request Entity Too Large", http.StatusRequestEntityTooLarge)
captureRavenError(r, err)
printError(r, err)
}
func printError(r *http.Request, err error) {
if r != nil {
log.Printf("error: %s %q: %v", r.Method, r.RequestURI, err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment