From bcefbe8c79fad685d8b33fe12032d41e1e81f7f8 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 5 Mar 2017 23:50:13 +0100 Subject: [PATCH] Stop waiting on error Signed-off-by: Knut Ahlers --- main.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index ab7595d..1b543de 100644 --- a/main.go +++ b/main.go @@ -229,7 +229,11 @@ func waitForJob(res http.ResponseWriter, r *http.Request) { return } - if status.Status != statusFinished { + switch status.Status { + case statusCreated: + fallthrough + + case statusStarted: u := urlMust(router.Get("waitForJob").URL("uid", uid.String())) u.Query().Set("loop", strconv.Itoa(loop)) @@ -237,10 +241,14 @@ func waitForJob(res http.ResponseWriter, r *http.Request) { http.Redirect(res, r, u.String(), http.StatusFound) return - } - u := urlMust(router.Get("downloadAssets").URL("uid", uid.String())) - http.Redirect(res, r, u.String(), http.StatusFound) + case statusError: + http.Error(res, "Processing ran into an error.", http.StatusInternalServerError) + + case statusFinished: + u := urlMust(router.Get("downloadAssets").URL("uid", uid.String())) + http.Redirect(res, r, u.String(), http.StatusFound) + } } func shouldPackFile(extension string) bool {