@@ -46,28 +46,31 @@ window.onerror = function(msg, url, lineNumber) {
4646 }
4747 }
4848
49- // Use setTimeout to prevent the following error if the app crashes right at the start:
50- // "The connection to the server was unsuccessful. (file:///android_asset/www/index.html)"
51- setTimeout ( function ( ) {
52- if ( typeof msg == "string" ) {
53- var sendError ,
54- confirmmsg = 'Unexpected error, please accept to report the bug so we can work on fixing it ' +
55- '(Internet connection required).' ;
49+ if ( msg . indexOf ( 'Can\'t find variable: cordova' ) == - 1 ) {
50+ // Use setTimeout to prevent the following error if the app crashes right at the start:
51+ // "The connection to the server was unsuccessful. (file:///android_asset/www/index.html)"
52+ setTimeout ( function ( ) {
53+ if ( typeof msg == "string" ) {
54+ var sendError ,
55+ confirmmsg = 'Unexpected error, please accept to report the bug so we can work on fixing it ' +
56+ '(Internet connection required).' ;
5657
57- sendError = confirm ( confirmmsg ) ;
58- if ( sendError ) {
59- // Wait for device ready so we can retrieve device data. In most cases device will already be ready.
60- document . addEventListener ( 'deviceready' , reportError ) ;
61- // Report error if device ready isn't fired after 5 seconds.
62- setTimeout ( reportError , 5000 ) ;
58+ sendError = confirm ( confirmmsg ) ;
59+ if ( sendError ) {
60+ // Wait for device ready so we can retrieve device data. In most cases device will already be ready.
61+ document . addEventListener ( 'deviceready' , reportError ) ;
62+ // Report error if device ready isn't fired after 5 seconds.
63+ setTimeout ( reportError , 5000 ) ;
64+ }
6365 }
64- }
6566
66- // This may help debugging if we use logging apps in iOs or Android.
67- if ( typeof console != "undefined" && typeof console . log == "function" ) {
68- console . log ( msg ) ;
69- }
70- } , 100 ) ;
67+ // This may help debugging if we use logging apps in iOs or Android.
68+ if ( typeof console != "undefined" && typeof console . log == "function" ) {
69+ console . log ( msg ) ;
70+ }
71+ } , 100 ) ;
72+ }
73+
7174 // Let default error handler run.
7275 return false ;
7376} ;
0 commit comments