Get Full Exception Error with Flex

一世执手 提交于 2019-12-25 01:49:50

问题


I can't use trace because I'm not using an Adobe IDE and when I try to view my exception errors, I can't seem to get the full error message, I only seem to get the "errorID". For example, if I had a 1069 error, I should see something like:

Error #1069: Property data not found on X and there is no default value.

But instead I see this...

ReferenceError: Error #1069

This is my code...

try
{
//error gets thrown here
}
catch(e:Error)
{
extTrace('Error: '+e.toString());//I also tried e.message, e.name & ObjectUtil.toString(e.getStackTrace())
}

This is just a function for simplifying logging to console. I'm not sure if it's the reason for the issue or not, due to console.log(''), but whatever...

private function extTrace(traceString:String):void
{
ExternalInterface.call("console.log('"+traceString+"')");
}

I also tried e.message, e.name & ObjectUtil.toString(e.getStackTrace())


回答1:


To get the full error message, you need to test in debug mode; it looks like you're running in release, which removes a lot of debug symbols




回答2:


In your try-catch block you get an object of type Error. That object has a method getStackTrace - http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Error.html#getStackTrace()



来源:https://stackoverflow.com/questions/18951933/get-full-exception-error-with-flex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!