From 6ec0c444f642630485ca18b3043191b67a6f8e8c Mon Sep 17 00:00:00 2001 From: Jokler Date: Sat, 12 May 2018 00:21:59 +0200 Subject: Factoids: Improve display of runtime errors in lua --- src/plugins/factoids/mod.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/plugins/factoids/mod.rs') 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 Factoids { } 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 Factoids { } } - fn run_lua( - &self, - name: &str, - code: &str, - command: &PluginCommand, - ) -> Result { + fn run_lua(&self, name: &str, code: &str, command: &PluginCommand) -> Result { let args = command .tokens .iter() -- cgit v1.2.3-70-g09d2