From: Michael Prager Date: Sat, 28 May 2011 11:34:35 +0000 (+0200) Subject: added startupSuccessful indicator, put all calendarService code inside try/catch... X-Git-Url: https://code.delx.au/comingnext/commitdiff_plain/370da72ef35a9512322d0f9deb2d0603b58c2077 added startupSuccessful indicator, put all calendarService code inside try/catch to catch any errors --- diff --git a/comingNext/index.html b/comingNext/index.html index 0551a3e..8bb8ab3 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -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 var errorOccured = false; var entryLists = null; // stores all fetched calendar entries until data is refreshed +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. // vars for daylight saving time var summertime = false; // true, if current date is in summer, false if in winter @@ -914,6 +915,8 @@ function init() window.widget.onshow = handleOnShow; log("init(): finished..."); + if (!errorOccured) + statupSuccessful = true; } function checkOrientation() @@ -1086,9 +1089,14 @@ function getSettingsCalEntryId() Type: 'DayEvent' } } - var result = calendarService.IDataSource.GetList(listFiltering); - if (result.ErrorCode) { - error('getSettingsCalEntryId: GetList() failed: ' + result.ErrorMessage); + var result = null; + try { + result = calendarService.IDataSource.GetList(listFiltering); + if (result.ErrorCode) + throw(result.ErrorMessage); + } + catch (e) { + error("getSettingsCalEntryId: GetList() failed: " + e + ', line ' + e.line); return; } var list = result.ReturnValue; @@ -1135,9 +1143,14 @@ function loadSettings() LocalId: settingsCalEntryId } } - var result = calendarService.IDataSource.GetList(listFiltering); - if (result.ErrorCode) { - error('loadSettings: GetList() failed: ' + result.ErrorMessage); + var result = null; + try { + result = calendarService.IDataSource.GetList(listFiltering); + if (result.ErrorCode) + throw(result.ErrorMessage); + } + catch (e) { + error("loadSettings: GetList() failed: " + e + ', line ' + e.line); return; } var entry = result.ReturnValue.getNext();