Windows 8 Development - Application Errors
13 June 2014
An event that is often overlooked, but which is extremely important for customer service and diagnosing of issues is the event that occurs when there is an unhandled exception. In the paradigm of web application development, you can control your hardware and rely on your application logs. But in the distributed world of mobile, the logs are all on the user's mobile device. In this scenario, it is important for you to be able to capture these problems and "phone them home" to be diagnosed/fixed (with the user's permission of course).
Your application should do the following in this situation:
- Dump logging and state information somewhere in local storage where you can retrieve it later for diagnostics.
- Remove any application state information that would otherwise be reloaded the next time the user opens your application. The state of the application should be assumed to be corrupt in this situation.
Unfortunately, there does not seem to be an event for this. The closest one is WinJS.Application.onerror. But, since there is no underlying way to catch an unhandled exception in the base library, I suspect there are many limitations. One scenario that I have run into is exceptions in an async event callback.
All of this being said, I believe it is important to use what you have in this situation whether it is a perfect solution or not. Therefore, I believe WinJS.Application.onerror should be handled when using WinJS.
is licensed under a Creative Commons Attribution 4.0 International License