don't expect/panic crash whole bot on malformed json
This commit is contained in:
parent
22cdf9ae20
commit
32931f54d6
|
@ -117,9 +117,10 @@ impl UpdateBot {
|
|||
o: 1,
|
||||
d: resp_message,
|
||||
};
|
||||
let response_json =
|
||||
serde_json::to_string(&response).expect("Error parsing json response");
|
||||
cwtch.send_message(&profile.handle, convo_id, &response_json);
|
||||
match serde_json::to_string(&response) {
|
||||
OK(response_json) => cwtch.send_message(&profile.handle, convo_id, &response_json),
|
||||
Err(e) => println!("Error parsing json response: {}", e.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue