@@ -408,7 +408,10 @@ pub enum LuaError {
408408 ReadError ( IoError ) ,
409409
410410 /// The call to `execute` has requested the wrong type of data.
411- WrongType ,
411+ WrongType {
412+ rust_expected : String ,
413+ lua_actual : String ,
414+ } ,
412415}
413416
414417impl fmt:: Display for LuaError {
@@ -419,7 +422,10 @@ impl fmt::Display for LuaError {
419422 SyntaxError ( ref s) => write ! ( f, "Syntax error: {}" , s) ,
420423 ExecutionError ( ref s) => write ! ( f, "Execution error: {}" , s) ,
421424 ReadError ( ref e) => write ! ( f, "Read error: {}" , e) ,
422- WrongType => write ! ( f, "Wrong type returned by Lua" ) ,
425+ WrongType {
426+ rust_expected : ref e1,
427+ lua_actual : ref e2
428+ } => write ! ( f, "Wrong type returned by Lua: {} expected, got {}" , e1, e2) ,
423429 }
424430 }
425431}
@@ -432,7 +438,7 @@ impl Error for LuaError {
432438 SyntaxError ( ref s) => & s,
433439 ExecutionError ( ref s) => & s,
434440 ReadError ( _) => "read error" ,
435- WrongType => "wrong type returned by Lua" ,
441+ WrongType { rust_expected : _ , lua_actual : _ } => "wrong type returned by Lua" ,
436442 }
437443 }
438444
@@ -443,7 +449,7 @@ impl Error for LuaError {
443449 SyntaxError ( _) => None ,
444450 ExecutionError ( _) => None ,
445451 ReadError ( ref e) => Some ( e) ,
446- WrongType => None ,
452+ WrongType { rust_expected : _ , lua_actual : _ } => None ,
447453 }
448454 }
449455}
0 commit comments