diff options
| author | Max Audron <audron@cocaine.farm> | 2021-10-10 16:11:00 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-10-10 16:11:00 +0200 |
| commit | a1f36810f47cb16bcd308665a68f4899b1d00ef1 (patch) | |
| tree | 686c9c13122703eebd728e816bc4b67b0d99fba0 /src/hooks/pet.rs | |
| parent | set correct path for rust ci template (diff) | |
fix and improve hook error handling
Diffstat (limited to '')
| -rw-r--r-- | src/hooks/pet.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hooks/pet.rs b/src/hooks/pet.rs index fd6abdb..4dec176 100644 --- a/src/hooks/pet.rs +++ b/src/hooks/pet.rs @@ -1,6 +1,6 @@ use std::str; -use anyhow::Result; +use anyhow::{Result, Context}; use irc::client::prelude::*; use macros::privmsg; @@ -26,8 +26,8 @@ const PET_RESPONSE: [&str; 5] = [ pub fn pet(bot: &crate::Bot, msg: Message) -> Result<()> { privmsg!(msg, { bot.send_action( - msg.response_target().unwrap(), - PET_RESPONSE.choose(&mut thread_rng()).unwrap(), + msg.response_target().context("failed to get response target")?, + PET_RESPONSE.choose(&mut thread_rng()).context("failed choosing a pet response")?, )?; }) } |
