Skip to content

Commit

Permalink
feat(gamblers): log response when check_offer is failed
Browse files Browse the repository at this point in the history
  • Loading branch information
universome committed Dec 25, 2016
1 parent d1c226b commit f3381bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/gamblers/cybbet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ impl Gambler for CybBet {

fn check_offer(&self, offer: &Offer, outcome: &Outcome, stake: Currency) -> Result<bool> {
let response = try!(self.try_place_bet("/games/checkbet", &offer, &outcome, stake));
Ok(response == r#"{"errorExpress":[],"errorSingle":[],"warning":""}"#)
let ok = response == r#"{"errorExpress":[],"errorSingle":[],"warning":""}"#;

if !ok {
warn!("Unexpected response in check_offer: {:?}", response);
}

Ok(ok)
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/gamblers/vitalbet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl Gambler for VitalBet {
let response = try!(self.try_place_bet(event, outcome, Currency(1)));

match response.ErrorMessage {
Some(m) => {
Some(ref m) => {
if m.contains("Minimum allowed stake") {
let min_stake = try!(m.as_str()
.trim_left_matches("Bet not accepted. Reason: Minimum allowed stake is '$")
Expand All @@ -220,6 +220,7 @@ impl Gambler for VitalBet {

Ok(stake >= Currency::from(min_stake))
} else {
warn!("Unexpected response in check_offer: {:?}", response);
Ok(false)
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/gamblers/xsporta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ impl Gambler for XBet {

Ok(stake >= Currency::from(min_stake))
} else {
warn!("Unexpected response in check_offer: {:?}", response);
Ok(false)
}
}
Expand Down Expand Up @@ -196,7 +197,7 @@ struct PlaceBetRequestEvent {
Type: u32
}

#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct PlaceBetResponse {
Error: String,
Success: bool
Expand Down

0 comments on commit f3381bf

Please sign in to comment.