From d8406b107c651321c9e166abc36fc66730d965a1 Mon Sep 17 00:00:00 2001 From: Jokler Date: Thu, 1 Mar 2018 18:34:03 +0100 Subject: Use lossy UTF8 conversion and add a log_error function --- src/plugins/url.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/plugins/url.rs') diff --git a/src/plugins/url.rs b/src/plugins/url.rs index af6f36f..6f00466 100644 --- a/src/plugins/url.rs +++ b/src/plugins/url.rs @@ -50,7 +50,7 @@ impl Url { fn url(&self, text: &str) -> Result { let url = self.grep_url(text).ok_or(UrlError::MissingUrl)?; - let body = utils::download(self.max_kib, &url)?; + let body = utils::download(&url, Some(self.max_kib))?; Ok(self.get_title(&body).ok_or(UrlError::MissingTitle)?) } @@ -72,10 +72,7 @@ impl Plugin for Url { match message.command { Command::PRIVMSG(_, ref content) => match self.url(content) { Ok(title) => client.send_privmsg(message.response_target().unwrap(), &title), - Err(e) => { - error!("Url plugin error: {}", e); - Ok(()) - } + Err(e) => Ok(utils::log_error(e)), }, _ => Ok(()), } -- cgit v1.2.3-70-g09d2