Skip to content

Commit c67afb4

Browse files
author
Matthew Fisher
committed
fix(builder): correctly handle error on request timeout
1 parent 9a2b425 commit c67afb4

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

builder/bin/publish-release-controller.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"flag"
66
"fmt"
77
"io/ioutil"
8+
"log"
89
"net/http"
910
"os"
1011
"regexp"
@@ -77,15 +78,14 @@ func main() {
7778

7879
res, err := client.Do(req)
7980

80-
if res.StatusCode == 404 {
81-
fmt.Println("Check the Controller. Is it running?")
82-
os.Exit(1)
81+
if err != nil {
82+
log.Fatalln(err)
8383
}
8484

85-
if err != nil || res.StatusCode != 200 {
86-
fmt.Println("failed retrieving config from controller")
87-
fmt.Println(res.Body)
88-
os.Exit(1)
85+
if res.StatusCode == 503 {
86+
log.Fatalln("check the controller. is it running?")
87+
} else if res.StatusCode != 200 {
88+
log.Fatalf("failed retrieving config from controller: %s\n", res.Body)
8989
}
9090

9191
defer res.Body.Close()

0 commit comments

Comments
 (0)