]> code.delx.au - comingnext/commitdiff
added startupSuccessful indicator, put all calendarService code inside try/catch...
authorMichael Prager <michael@pragers.de>
Sat, 28 May 2011 11:34:35 +0000 (13:34 +0200)
committerMichael Prager <michael@pragers.de>
Sat, 28 May 2011 11:34:35 +0000 (13:34 +0200)
comingNext/index.html

index 0551a3ed4304b50afda37ff1c54d877e483fc8c3..8bb8ab3a4c70c1d5e9853d349d7ead479bd58f8c 100644 (file)
@@ -104,6 +104,7 @@ var lastReloadTime = null; // last time we fetched calendar data
 var reloadInterval = 6 * 60 * 60 * 1000; // = 6 hours; time interval for reloading calendar data\r
 var errorOccured = false;\r
 var entryLists = null; // stores all fetched calendar entries until data is refreshed\r
+var statupSuccessful = false; // indicates if everything started up wihtout errors. If we detect an error after that, it might just be a temporary problem e.g. by a backup process.\r
 \r
 // vars for daylight saving time\r
 var summertime = false; // true, if current date is in summer, false if in winter\r
@@ -914,6 +915,8 @@ function init()
        window.widget.onshow = handleOnShow;\r
 \r
        log("init(): finished...");\r
+       if (!errorOccured)\r
+               statupSuccessful = true;\r
 }\r
 \r
 function checkOrientation()\r
@@ -1086,9 +1089,14 @@ function getSettingsCalEntryId()
                                Type: 'DayEvent'\r
                        }\r
                }\r
-               var result = calendarService.IDataSource.GetList(listFiltering);\r
-               if (result.ErrorCode) {\r
-                       error('getSettingsCalEntryId: GetList() failed: ' + result.ErrorMessage);\r
+               var result = null;\r
+               try {\r
+                       result = calendarService.IDataSource.GetList(listFiltering);\r
+                       if (result.ErrorCode)\r
+                               throw(result.ErrorMessage);\r
+               }\r
+               catch (e) {\r
+                       error("getSettingsCalEntryId: GetList() failed: " + e + ', line ' + e.line);\r
                        return;\r
                }\r
                var list = result.ReturnValue;\r
@@ -1135,9 +1143,14 @@ function loadSettings()
                        LocalId: settingsCalEntryId\r
                }\r
        }\r
-       var result = calendarService.IDataSource.GetList(listFiltering);\r
-       if (result.ErrorCode) {\r
-               error('loadSettings: GetList() failed: ' + result.ErrorMessage);\r
+       var result = null;\r
+       try     {\r
+               result = calendarService.IDataSource.GetList(listFiltering);\r
+               if (result.ErrorCode)\r
+                       throw(result.ErrorMessage);\r
+       }\r
+       catch (e) {\r
+               error("loadSettings: GetList() failed: " + e + ', line ' + e.line);\r
                return;\r
        }\r
        var entry = result.ReturnValue.getNext();\r