1
0
Fork 0
mirror of https://github.com/Luzifer/tex-api.git synced 2024-11-14 02:52:43 +00:00

Fix broken error handling

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-07-06 18:52:05 +02:00
parent e0805011b5
commit b86f1dbb64
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -138,7 +138,7 @@ func startNewJob(res http.ResponseWriter, r *http.Request) {
if f, err := os.Create(inputFile); err == nil { if f, err := os.Create(inputFile); err == nil {
defer f.Close() 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) serverErrorf(res, copyErr, "Unable to copy input file %q", inputFile)
return return
} }
@ -174,7 +174,7 @@ func getJobStatus(res http.ResponseWriter, r *http.Request) {
} }
if status, err := loadStatusByUUID(uid); err == nil { 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") serverErrorf(res, encErr, "Unable to serialize status file")
return return
} }