diff options
| author | Jokler <jokler.contact@gmail.com> | 2018-03-01 18:34:03 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2018-03-01 18:34:03 +0100 |
| commit | d8406b107c651321c9e166abc36fc66730d965a1 (patch) | |
| tree | a9918c8a98ad3c8d32c46d8b2b1518e43743b056 /src/plugins/url.rs | |
| parent | 7cdca0b7d75172d8f900e8e755ff07ed8a72966a (diff) | |
| download | frippy-d8406b107c651321c9e166abc36fc66730d965a1.tar.gz frippy-d8406b107c651321c9e166abc36fc66730d965a1.zip | |
Use lossy UTF8 conversion and add a log_error function
Diffstat (limited to 'src/plugins/url.rs')
| -rw-r--r-- | src/plugins/url.rs | 7 |
1 files changed, 2 insertions, 5 deletions
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<String, FrippyError> { 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(()), } |
