titaniumtitanium-mobileappcelerator-titaniumunhandled-exceptiontitanium-android

one place to catch all sudden exceptions in titanium?


I am new to Titanium Android App development and going through an unpleasant scenario of "Network goes off" during use of my app. I tried reproducing it on my emulator, but going "Airplane mode" while app still working.

I tried below in app.js:

Ti.App.addEventListener('uncaughtException',function(){
alert("caught"); });  

Ti.App.addEventListener('TiException',function(){
alert("caught:Ti"); });

So good thing is I am able to see "caught" but not before my app sees a red screen detailing and it breaks. see image: App crash error

it would be very helpful if someone can help me out in identifying how to catch all those 'unplanned' exceptions and direct them as per some business logic so that user doesnot see those blasts.

Thanks in advance


Solution

  • The exception that you are seeing is related to LiveView. See the docs here: http://docs.appcelerator.com/platform/latest/#!/guide/LiveView which is totally unrelated to the code on the app.

    If you are going to test offline mode in your app you need to run it without LiveView because it requires connectivity to work.

    For reference:

    The event that catches all the exceptions is uncaughtException

    TiException is not a valid event so it will never be triggered.