Skip to content

Commit 806246c

Browse files
committed
Improve debug print statements in dev/load.go
1 parent e90e8f6 commit 806246c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dev/load.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"os"
2626
"time"
2727

28+
"github.com/cortexlabs/cortex/pkg/lib/debug"
2829
"github.com/cortexlabs/cortex/pkg/lib/files"
2930
)
3031

@@ -100,13 +101,18 @@ func makeRequestLoop(url string, jsonBytes []byte) {
100101
response, _, err := makeRequest(url, jsonBytes)
101102

102103
if err != nil {
103-
fmt.Print(err.Error())
104+
fmt.Print("\n" + debug.Sppg(err))
104105
continue
105106
}
106107

107108
if response.StatusCode != 200 {
108-
fmt.Print(response.StatusCode)
109-
fmt.Print(" ")
109+
bodyBytes, err := ioutil.ReadAll(response.Body)
110+
response.Body.Close()
111+
if err == nil {
112+
fmt.Printf("\nstatus code: %d; body: %s\n", response.StatusCode, string(bodyBytes))
113+
} else {
114+
fmt.Printf("\nstatus code: %d; error reading body: %s\n", response.StatusCode, string(err.Error()))
115+
}
110116
continue
111117
}
112118

0 commit comments

Comments
 (0)