"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lettre 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lettre_email 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
use diesel::PgConnection;
use failure::Error;
+use log::warn;
use rand::{rngs::ThreadRng, Rng};
use serde::{Deserialize, Serialize};
use serde_json::Value;
type Result = MessageResult<StandardMessage>;
fn handle(&mut self, msg: StandardMessage, _: &mut Context<Self>) -> Self::Result {
- let msg_out = match parse_json_message(self, msg) {
- Ok(m) => m,
- Err(e) => e.to_string(),
- };
-
- println!("Message Sent: {}", msg_out);
- MessageResult(msg_out)
+ match parse_json_message(self, msg) {
+ Ok(m) => {
+ println!("Message Sent: {}", m);
+ MessageResult(m)
+ }
+ Err(e) => {
+ warn!("Error during message handling {}", e);
+ MessageResult(e.to_string())
+ }
+ }
}
}