Catch error on command execution with include-command-output-in-response=false
This commit is contained in:
parent
8c96ffd5f9
commit
7d10bd8bbc
@ -277,18 +277,17 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set(responseHeader.Name, responseHeader.Value)
|
||||
}
|
||||
|
||||
if matchedHook.CaptureCommandOutput {
|
||||
response, err := handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
||||
|
||||
if err != nil {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
fmt.Fprintf(w, "Error occurred while executing the hook's command. Please check your logs for more details.")
|
||||
} else {
|
||||
fmt.Fprintf(w, response)
|
||||
return
|
||||
}
|
||||
|
||||
if matchedHook.CaptureCommandOutput {
|
||||
fmt.Fprintf(w, response)
|
||||
} else {
|
||||
go handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
||||
fmt.Fprintf(w, matchedHook.ResponseMessage)
|
||||
}
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user