问题
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