From a1f36810f47cb16bcd308665a68f4899b1d00ef1 Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sun, 10 Oct 2021 16:11:00 +0200 Subject: fix and improve hook error handling --- src/hooks/intensify.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/hooks/intensify.rs') diff --git a/src/hooks/intensify.rs b/src/hooks/intensify.rs index 87a4edf..4c63598 100644 --- a/src/hooks/intensify.rs +++ b/src/hooks/intensify.rs @@ -1,4 +1,4 @@ -use anyhow::Result; +use anyhow::{Result, Context}; use irc::client::prelude::*; use macros::privmsg; @@ -10,7 +10,7 @@ pub fn intensify(bot: &crate::Bot, msg: Message) -> Result<()> { let content = chars.as_str(); bot.send_privmsg( - msg.response_target().unwrap(), + msg.response_target().context("failed to get response target")?, format!("\x02\x0304[\x1d{} INTENSIFIES\x1d]\x03\x0F", content.to_uppercase()).as_str(), )?; }) -- cgit v1.2.3