Skip to content
Permalink
Browse files

Log the status code when a hook script can't load

I've occasionally seen tests fail to load the hooks script. I am
unsure why, but adding this logging might provide more information
when it happens.

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
  • Loading branch information...
bowlofeggs authored and mergify committed Sep 17, 2019
1 parent 40217b4 commit 2aad5c4ea656c12f5d6813c31c22a890f22abda1
Showing with 5 additions and 2 deletions.
  1. +5 −2 hookrun/runhooks.go
@@ -155,8 +155,11 @@ func getScripts(request datastructures.HookRunRequest, workdir string) error {
return errors.Wrap(err, "Error retrieving hook script")
}
if resp.StatusCode != 200 {
fmt.Fprintln(os.Stderr, "Unable to retrieve hook script")
return errors.New("Unable to retrieve hook script")
msg := fmt.Sprintf(
"Unable to retrieve hook script, received status code %d",
resp.StatusCode)
fmt.Fprintln(os.Stderr, msg)
return errors.New(msg)
}

_, err = io.Copy(script, resp.Body)

0 comments on commit 2aad5c4

Please sign in to comment.
You can’t perform that action at this time.