From e9e683d0030d9a459ecd6183c8250d0dc42662ef Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Sun, 3 Mar 2019 12:22:22 -0500 Subject: improve error handling --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 044e6cf..1116b1f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,12 +107,16 @@ fn run() -> Result<()> { result }) - .after(|_ctx, _msg, cmd, err| { + .after(|_ctx, msg, cmd, err| { match err { Ok(()) => { trace!("command '{}' completed successfully", cmd); }, Err(e) => { + if let Err(e) = crate::commands::send(msg.channel_id, "BANIC", msg.tts) { + error!("sending BANIC: {}", e); + } + error!("error encountered handling command '{}': {:?}", cmd, e); } } -- cgit v1.3.1