mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-25 16:15:17 +00:00
Merge pull request #5 from QuilibriumNetwork/status-codes
handle non-200 status codes
This commit is contained in:
commit
d43a4aeac8
17
bootstrap.go
17
bootstrap.go
@ -98,10 +98,14 @@ func JoinLobby() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
} else {
|
} else {
|
||||||
_, err := io.ReadAll(resp.Body)
|
responseData, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
} else {
|
} else {
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
fmt.Printf("Status code %d given by sequencer: \n", resp.StatusCode)
|
||||||
|
panic(string(responseData))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,6 +129,12 @@ func GetSequencerState() string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
fmt.Printf("Status code %d given by sequencer: \n", resp.StatusCode)
|
||||||
|
panic(string(sequencerState))
|
||||||
|
}
|
||||||
|
|
||||||
return string(sequencerState)
|
return string(sequencerState)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +154,11 @@ func Bootstrap() {
|
|||||||
bcjBytes, err := io.ReadAll(bcjRes.Body)
|
bcjBytes, err := io.ReadAll(bcjRes.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
} else {
|
||||||
|
if bcjRes.StatusCode != 200 {
|
||||||
|
fmt.Printf("Status code %d given by sequencer: \n", bcjRes.StatusCode)
|
||||||
|
panic(string(bcjBytes))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(bcjBytes, bcj); err != nil {
|
if err := json.Unmarshal(bcjBytes, bcj); err != nil {
|
||||||
|
2
main.go
2
main.go
@ -104,7 +104,7 @@ func PrintLogo() {
|
|||||||
|
|
||||||
func PrintVersion() {
|
func PrintVersion() {
|
||||||
fmt.Println(" ")
|
fmt.Println(" ")
|
||||||
fmt.Println(" Quilibrium Ceremony Client - CLI - v1.0.1")
|
fmt.Println(" Quilibrium Ceremony Client - CLI - v1.0.2")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user