문제

When I run a Flex/AIR application in debug mode and an error occurs, I see this:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

However when the application has been installed as a release build and the same error happens, I don't see an error message.

Is it possible for my application to either save these types of errors to a log file or email them to me?

도움이 되었습니까?

해결책

I have managed to implement this myself using the UncaughtErrorEvent and airxmail classes.

It was a simple case of adding the UncaughtError event to loaderInfo (within a method which is called by the FlexEvent.APPLICATION_COMPLETE event). Using these two classes, the application emails the runtime errors to me as and when they occur, in release mode only as the UncaughtError event does not fire in debug mode.

다른 팁

If you want to log your uncaught errors you can use the uncaughtError event.

loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR,handleGlobalErrors);

function handleGlobalErrors( evt : UncaughtErrorEvent ):void
{
    //code that saves error to log or send by email..
    evt.preventDefault();
}

You can find more information about this feature here http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/UncaughtErrorEvent.html.

Also beware that if you use this in Debug mode all your errors will be caught by the handleGlobalErrors function so keep that in mind.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top