Skip to content

Commit d43a4ae

Browse files
authored
Merge pull request #5 from QuilibriumNetwork/status-codes
handle non-200 status codes
2 parents e745f31 + d9d2a1b commit d43a4ae

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

bootstrap.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ func JoinLobby() {
9898
if err != nil {
9999
panic(err)
100100
} else {
101-
_, err := io.ReadAll(resp.Body)
101+
responseData, err := io.ReadAll(resp.Body)
102102
if err != nil {
103103
panic(err)
104104
} else {
105+
if resp.StatusCode != 200 {
106+
fmt.Printf("Status code %d given by sequencer: \n", resp.StatusCode)
107+
panic(string(responseData))
108+
}
105109
return
106110
}
107111
}
@@ -125,6 +129,12 @@ func GetSequencerState() string {
125129
if err != nil {
126130
panic(err)
127131
}
132+
133+
if resp.StatusCode != 200 {
134+
fmt.Printf("Status code %d given by sequencer: \n", resp.StatusCode)
135+
panic(string(sequencerState))
136+
}
137+
128138
return string(sequencerState)
129139
}
130140

@@ -144,6 +154,11 @@ func Bootstrap() {
144154
bcjBytes, err := io.ReadAll(bcjRes.Body)
145155
if err != nil {
146156
panic(err)
157+
} else {
158+
if bcjRes.StatusCode != 200 {
159+
fmt.Printf("Status code %d given by sequencer: \n", bcjRes.StatusCode)
160+
panic(string(bcjBytes))
161+
}
147162
}
148163

149164
if err := json.Unmarshal(bcjBytes, bcj); err != nil {

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func PrintLogo() {
104104

105105
func PrintVersion() {
106106
fmt.Println(" ")
107-
fmt.Println(" Quilibrium Ceremony Client - CLI - v1.0.1")
107+
fmt.Println(" Quilibrium Ceremony Client - CLI - v1.0.2")
108108
fmt.Println()
109109
fmt.Println()
110110
}

0 commit comments

Comments
 (0)