Skip to content

Commit

Permalink
Improve response output
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcnunes committed Nov 13, 2016
1 parent 50125cf commit c4a364b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,18 @@ func handleSubmit(w http.ResponseWriter, r *http.Request, defaults []string) {
out, err := exec.Command("spark-submit", args...).CombinedOutput()
logDebug(string(out))

if out != nil {
http.Error(w, string(out), 400)
return
}

if err != nil {
http.Error(w, err.Error(), 400)
msg := err.Error()
if out != nil {
msg = string(out)
}

http.Error(w, msg, 400)
return
}

w.WriteHeader(200)
w.Write(out)
}

func main() {
Expand Down

0 comments on commit c4a364b

Please sign in to comment.