From b86f1dbb6409614ae964a971b1d109d5ce6c3756 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 6 Jul 2019 18:52:05 +0200 Subject: [PATCH] Fix broken error handling Signed-off-by: Knut Ahlers --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index c436e3a..30deb45 100644 --- a/main.go +++ b/main.go @@ -138,7 +138,7 @@ func startNewJob(res http.ResponseWriter, r *http.Request) { if f, err := os.Create(inputFile); err == nil { defer f.Close() - if _, copyErr := io.Copy(f, r.Body); err != nil { + if _, copyErr := io.Copy(f, r.Body); copyErr != nil { serverErrorf(res, copyErr, "Unable to copy input file %q", inputFile) return } @@ -174,7 +174,7 @@ func getJobStatus(res http.ResponseWriter, r *http.Request) { } if status, err := loadStatusByUUID(uid); err == nil { - if encErr := json.NewEncoder(res).Encode(status); err != nil { + if encErr := json.NewEncoder(res).Encode(status); encErr != nil { serverErrorf(res, encErr, "Unable to serialize status file") return }