@@ -408,7 +408,10 @@ pub enum LuaError {
408
408
ReadError ( IoError ) ,
409
409
410
410
/// The call to `execute` has requested the wrong type of data.
411
- WrongType ,
411
+ WrongType {
412
+ rust_expected : String ,
413
+ lua_actual : String ,
414
+ } ,
412
415
}
413
416
414
417
impl fmt:: Display for LuaError {
@@ -419,7 +422,10 @@ impl fmt::Display for LuaError {
419
422
SyntaxError ( ref s) => write ! ( f, "Syntax error: {}" , s) ,
420
423
ExecutionError ( ref s) => write ! ( f, "Execution error: {}" , s) ,
421
424
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) ,
423
429
}
424
430
}
425
431
}
@@ -432,7 +438,7 @@ impl Error for LuaError {
432
438
SyntaxError ( ref s) => & s,
433
439
ExecutionError ( ref s) => & s,
434
440
ReadError ( _) => "read error" ,
435
- WrongType => "wrong type returned by Lua" ,
441
+ WrongType { rust_expected : _ , lua_actual : _ } => "wrong type returned by Lua" ,
436
442
}
437
443
}
438
444
@@ -443,7 +449,7 @@ impl Error for LuaError {
443
449
SyntaxError ( _) => None ,
444
450
ExecutionError ( _) => None ,
445
451
ReadError ( ref e) => Some ( e) ,
446
- WrongType => None ,
452
+ WrongType { rust_expected : _ , lua_actual : _ } => None ,
447
453
}
448
454
}
449
455
}
0 commit comments