Handling the Error Event
By default, when there is an unhandled error in a Windows Store app—an error that is not handled within a try...catch
block—the following three things happen:
1. The error is logged by calling the WinJS.log()
method.
2. The debugger statement is called to break into the debugger when the app is running in Visual Studio in Debug mode.
3. The app is terminated by calling the MSApp.terminateApp()
method.
After the terminateApp()
method is called, the user is thrown back to the Windows Start screen (violently, unexpectedly, and without explanation).
You can handle the application error event to provide a better user experience. For example, here’s how you can display a message to the user when an unhandled error happens: ...
Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.