Skip to content

Commit

Permalink
return error message when target is not ok
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Apr 3, 2020
1 parent fed05e2 commit 9570e20
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ogame.go
Original file line number Diff line number Diff line change
Expand Up @@ -2828,6 +2828,10 @@ type CheckTargetResponse struct {
Type int `json:"type"`
Name string `json:"name"`
} `json:"targetPlanet"`
Errors []struct {
Message string `json:"message"`
Error int `json:"error"`
} `json:"errors"`
TargetOk bool `json:"targetOk"`
Components []interface{} `json:"components"`
}
Expand Down Expand Up @@ -2973,6 +2977,9 @@ func (b *OGame) sendFleetV7(celestialID CelestialID, ships []Quantifiable, speed
}

if !checkRes.TargetOk {
if len(checkRes.Errors) > 0 {
return Fleet{}, errors.New(checkRes.Errors[0].Message)
}
return Fleet{}, errors.New("target is not ok")
}

Expand Down

0 comments on commit 9570e20

Please sign in to comment.