diff options
| author | Jokler <jokler.contact@gmail.com> | 2018-05-12 00:21:59 +0200 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2018-05-12 00:21:59 +0200 |
| commit | 6ec0c444f642630485ca18b3043191b67a6f8e8c (patch) | |
| tree | 433d04f5b51dfb287536dd624b5c24075b5d227f /src/plugins/factoids/mod.rs | |
| parent | 518fa4a3d523b481e2d72e78361dd979e6c850f4 (diff) | |
| download | frippy-6ec0c444f642630485ca18b3043191b67a6f8e8c.tar.gz frippy-6ec0c444f642630485ca18b3043191b67a6f8e8c.zip | |
Factoids: Improve display of runtime errors in lua
Diffstat (limited to 'src/plugins/factoids/mod.rs')
| -rw-r--r-- | src/plugins/factoids/mod.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/plugins/factoids/mod.rs b/src/plugins/factoids/mod.rs index ba3ee8a..a15b60a 100644 --- a/src/plugins/factoids/mod.rs +++ b/src/plugins/factoids/mod.rs @@ -176,7 +176,10 @@ impl<T: Database> Factoids<T> { } else { match self.run_lua(&name, &content, &command) { Ok(v) => v, - Err(e) => format!("{}", e), + Err(e) => match e { + LuaError::CallbackError { cause, .. } => cause.to_string(), + _ => e.to_string(), + }, } } } else { @@ -187,12 +190,7 @@ impl<T: Database> Factoids<T> { } } - fn run_lua( - &self, - name: &str, - code: &str, - command: &PluginCommand, - ) -> Result<String, rlua::Error> { + fn run_lua(&self, name: &str, code: &str, command: &PluginCommand) -> Result<String, LuaError> { let args = command .tokens .iter() |
