I am currently trying to implement an automated error reporter for a Flex application and would like to return error messages to the server along with the function / line number that caused the error. Essentially, I'm trying to get getStackTrace () information without in debug mode, because most users of the application are unlikely to have a debug version of the flash player.
My current method uses the UncaughtErrorEvent handler to detect errors that occur in the application, but the error message returns only the type of error, not the location (which means it's useless). I tried to implement getStackTrace () myself using a name-grabber function such as
private function getFunctionName (callee:Function, parent:Object):String { for each ( var m:XML in describeType(parent)..method) { if ( this[ m.@name ] == callee) return m.@name ; } return "private function!"; }
but this will only work because of arguments.callee, and therefore will not go through several levels of function calls (it will never exceed my error event listener).
So! Anyone have ideas on how to receive error information messages through the global error event handler?
EDIT . There seems to be some misunderstanding. I explicitly avoid getStackTrace () because it returns "null" if not in debug mode. Any solution using this feature is something that I specifically avoid.
source share