我在C#中嵌入IronPython 2.0。在IronPython的,我定義我自己的異常,並:在C#中捕捉Ironpython異常#
def foobarException(Exception):
pass
某處有提高吧:在C#
raise foobarException("This is the Exception Message")
現在,我有:
try
{
callIronPython();
}
catch (Exception e)
{
// How can I determine the name (foobarException) of the Exception
// that is thrown from IronPython?
// With e.Message, I get "This is the Exception Message"
}
你試過用調試器嗎?您應該看到異常類型或內部異常,或者存儲實際python異常的地方。 – OregonGhost 2009-03-05 12:33:27
是的,我試着用調試器,但找不到它。 事情是它與IronPython 1.1一起工作。當我在e.Data [「PythonExceptionInfo」]中正確記得時,實際上有python exception.message。在e.Message中有Exception的名字。 – foobar 2009-03-05 14:51:52