GameCTO / luainterface

Automatically exported from code.google.com/p/luainterface
0 stars 0 forks source link

Request to have .NET exception object or text of inner exception returned to a Lua script when .NET throws an exception. #59

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Luainterface should return the actual exception object when a .NET exception 
occurs. "A .NET exception occurred in user-code" is useless for the purposes of 
debugging.
I realize that pcall would not be able to handle this, but a wrapper could be 
added to Luainterface that would replace it.
--
local ok, err = try( function() button = Button() end )
--
If it fails (ok = false) then err would contain the .Net exception object.
An alternative would be that rather than passing the text of the outer 
exception, the text of the inner one would be returned instead.
This doesn't seem necessary since most uses of Luainterface is to embed Lua 
scripts into .NET applications. However, if one uses the interface to invoke 
.NET services from Lua scripts from external applications (for instance, a MUD 
client) there is no native debugging mechanism. Being able to look at the 
exception object or the inner exception text would go a long ways to alliviate 
this problem.

Original issue reported on code.google.com by anaris...@gmail.com on 28 Mar 2013 at 2:06