Bug 340949: different error handling, minor logging

This commit is contained in:
daniel.boelzle%sun.com 2006-11-08 14:56:55 +00:00
Родитель 68cbe776bc
Коммит a4474b25e6
4 изменённых файлов: 15 добавлений и 34 удалений

Просмотреть файл

@ -118,7 +118,8 @@ calWcapCalendar.prototype = {
function()
{
var str = this.session.toString();
str += (", calId=" + this.calId);
str += (", calId=" +
(this.session.isLoggedIn ? this.calId : this.m_calId));
return str;
},
log:
@ -260,8 +261,7 @@ calWcapCalendar.prototype = {
// like a subscribed one...
m_calId: null,
get calId() {
var userId = this.session.defaultCalId; // assure being logged in
return this.m_calId || userId;
return this.m_calId || this.session.defaultCalId;
},
set calId( id ) {
this.log( "setting calId to " + id );
@ -275,7 +275,7 @@ calWcapCalendar.prototype = {
var ar = this.getCalendarProperties("X-NSCP-CALPROPS-PRIMARY-OWNER",{});
if (ar.length < 1 || ar[0].length == 0) {
var calId = this.calId;
this.notifyError(
this.logError(
"cannot determine primary owner of calendar " + calId );
// fallback to calId prefix:
var nColon = calId.indexOf(":");
@ -348,7 +348,6 @@ calWcapCalendar.prototype = {
// call the readOnly attribute, thus we would run into
// endless recursion here:
this_.m_bReadOnly = true;
// this_.notifyError( exc );
// just logging here, because user may have dangling
// users referred in his subscription list:
this_.logError( exc );
@ -366,7 +365,7 @@ calWcapCalendar.prototype = {
// patch to read-only here, because error notification call the
// readOnly attribute, thus we would run into endless recursion here
this.m_bReadOnly = true;
this.notifyError( exc );
this.logError( exc );
throw exc;
}
return this.m_calProps;
@ -375,15 +374,11 @@ calWcapCalendar.prototype = {
get defaultTimezone() {
var tzid = this.getCalendarProperties("X-NSCP-CALPROPS-TZID", {});
if (tzid.length < 1 || tzid[0].length == 0) {
this.logError( "cannot get X-NSCP-CALPROPS-TZID!" );
return "UTC"; // fallback
}
return tzid[0];
},
// set defaultTimezone( tzid ) {
// if (this.readOnly)
// // xxx todo:
// throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
// },
getAlignedTimezone:
function( tzid )
@ -401,7 +396,7 @@ calWcapCalendar.prototype = {
// user's default if not supported directly
var ret = this.defaultTimezone;
// use calendar's default:
this.log( tzid + " not supported, falling back to default: " + ret);
this.log(tzid + " not supported, falling back to default: " + ret);
return ret;
}
else // is ok (supported):

Просмотреть файл

@ -146,7 +146,8 @@ function initWcapProvider()
}
SUPPRESS_ALARMS = getPref("calendar.wcap.suppress_alarms", false);
logMessage( "calendar.wcap.suppress_alarms", SUPPRESS_ALARMS );
logMessage("calendar.wcap.suppress_alarms",
SUPPRESS_ALARMS.toString());
// init cache dir directory:
CACHE = getPref("calendar.wcap.cache", "off");

Просмотреть файл

@ -121,15 +121,12 @@ calWcapSession.prototype = {
if (this.m_sessionId == null) {
str += (getIoService().offline ? ", offline" : ", not logged in");
}
// else {
// str += (", session-id=" + this.m_sessionId);
// }
return str;
},
log:
function( msg )
function( msg, context )
{
return logMessage( this.toString(), msg );
return logMessage( context ? context : this.toString(), msg );
},
logError:
function( err, context )
@ -818,7 +815,7 @@ calWcapSession.prototype = {
return this.getCalendarByCalId( this.userId + ":" + calId );
}
catch (exc) {
this.notifyError( exc );
this.logError( exc );
throw exc;
}
},
@ -835,7 +832,7 @@ calWcapSession.prototype = {
this.m_calIdToCalendar[encodeURIComponent(calId)] = null;
}
catch (exc) {
this.notifyError( exc );
this.logError( exc );
throw exc;
}
},
@ -857,7 +854,7 @@ calWcapSession.prototype = {
this.m_userPrefs = null; // reread prefs
}
catch (exc) {
this.notifyError( exc );
this.logError( exc );
throw exc;
}
},
@ -894,7 +891,7 @@ calWcapSession.prototype = {
return ret;
}
catch (exc) {
this.notifyError( exc );
this.logError( exc );
throw exc;
}
},

Просмотреть файл

@ -55,7 +55,6 @@ interface calIWcapSession : nsISupports
* User that has established this session.
* Reading this attribute prompts for login if the session has not yet
* been established.
* An error is notified to all registered calIObservers, then thrown.
*/
readonly attribute string userId;
@ -71,7 +70,6 @@ interface calIWcapSession : nsISupports
* will establish a session automatically.
* If the user is already logged in, she will be logged out before.
* UI will prompt for a userId and password.
* An error is notified to all registered calIObservers, then thrown.
*/
void login();
@ -80,7 +78,6 @@ interface calIWcapSession : nsISupports
* Commonly not needed, because the user will be logged out upon
* "network:offline-about-to-go-offline" and "quit-application"
* automatically.
* An error is notified to all registered calIObservers, then thrown.
*/
void logout();
@ -95,13 +92,11 @@ interface calIWcapSession : nsISupports
/**
* The user's default calendar.
* An error is notified to all registered calIObservers, then thrown.
*/
readonly attribute calIWcapCalendar defaultCalendar;
/**
* Gets a calendar instance for the passed calId using this session.
* An error is notified to all registered calIObservers, then thrown.
*
* @param calId full calId (incl. "<user>:")
* @return calendar instance
@ -111,7 +106,6 @@ interface calIWcapSession : nsISupports
/**
* Gets calendars where the user is the primary owner
* (including default calendar).
* An error is notified to all registered calIObservers, then thrown.
*
* @return array of owned calendars
*/
@ -122,7 +116,6 @@ interface calIWcapSession : nsISupports
/**
* Gets subscribed calendars (may include calendars where the user
* is the primary owner).
* An error is notified to all registered calIObservers, then thrown.
*
* @return array of subscribed calendars
*/
@ -132,7 +125,6 @@ interface calIWcapSession : nsISupports
/**
* Creates a new calendar for the session's user.
* An error is notified to all registered calIObservers, then thrown.
*
* @param calId calendar's calId (portion);
* without user's id, e.g. "test-cal".
@ -161,7 +153,6 @@ interface calIWcapSession : nsISupports
/**
* Deletes a calendar.
* An error is notified to all registered calIObservers, then thrown.
*
* @param calId full calId (incl. "<user>:")
* @param bRemoveFromSubscribed whether calendar ought to be removed
@ -173,7 +164,6 @@ interface calIWcapSession : nsISupports
/**
* Subscribe to calendar(s).
* An error is notified to all registered calIObservers, then thrown.
*
* @param count number of calIds
* @param calIds array of calIds (calid or "mailto:rfc822addr")
@ -184,7 +174,6 @@ interface calIWcapSession : nsISupports
/**
* Unsubscribe from calendar(s).
* An error is notified to all registered calIObservers, then thrown.
*
* @param count number of calIds
* @param calIds array of calIds (calid or "mailto:rfc822addr")
@ -195,7 +184,6 @@ interface calIWcapSession : nsISupports
/**
* Gets the user's preferences.
* An error is notified to all registered calIObservers, then thrown.
*
* @param prefName preference name
* @return array of preference values