diff options
| author | Jokler <jokler.contact@gmail.com> | 2018-03-02 22:11:21 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2018-03-02 22:11:21 +0100 |
| commit | 0b4131e8cf91ed10f24d3faed341034d518aea53 (patch) | |
| tree | 09498ec2f2ec495a1b45a6762e61ed67f496c6f8 /src/plugins/factoids/utils.rs | |
| parent | 0bcc7c0923852b48ebbb94ceeecc98f551fa920d (diff) | |
| download | frippy-0b4131e8cf91ed10f24d3faed341034d518aea53.tar.gz frippy-0b4131e8cf91ed10f24d3faed341034d518aea53.zip | |
Use Error & ErrorKind pair instead of simple enums
Each plugin should define its own errors with a respective variant
in the main ErrorKind of frippy.
A new procedural macro was added to reduce the boilerplate required
for new error system.
It can be used by deriving "Error" and adding a name for the Error
via the "error" attribute.
So far non of the plugins except for Url and Factoids
use their own errors yet.
Diffstat (limited to 'src/plugins/factoids/utils.rs')
| -rw-r--r-- | src/plugins/factoids/utils.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/factoids/utils.rs b/src/plugins/factoids/utils.rs index 009b46b..70ac8a7 100644 --- a/src/plugins/factoids/utils.rs +++ b/src/plugins/factoids/utils.rs @@ -11,7 +11,11 @@ use self::LuaError::RuntimeError; pub fn download(_: &Lua, url: String) -> Result<String, LuaError> { match utils::download(&url, Some(1024)) { Ok(v) => Ok(v), - Err(e) => Err(RuntimeError(format!("Failed to download {} - {}", url, e.to_string()))), + Err(e) => Err(RuntimeError(format!( + "Failed to download {} - {}", + url, + e.to_string() + ))), } } |
