CalendarError

The CalendarError object contains error codes and is returned in the error callback.

Installation:

To use this API in your project, add the calendar plugin:

webworks plugin add com.blackberry.pim.calendar
Properties:
Number code

code

A code specifying the type of error that occurred.

Example:

var calendar = blackberry.pim.calendar,
    evt;

function saveEvent() {
   // Not providing the end date will cause
   // INVALID_ARGUMENT_ERROR
   evt = calendar.createEvent({
       "summary": "A test Event",
       "location": "Waterloo",
       "start": new Date("Jan 01, 2015, 12:00"),
       "timezone": "America/New_York"
    });
    evt.save(onSaveSuccess, onSaveError);
}

function onSaveSuccess(created) {
   // set evt to the object returned in save success callback, which
   // contains the persisted event id
   evt = created;
   alert("Event saved to device: " + evt.id);
}

function onSaveError(error) {
    switch (error.code) {
        case error.UNKNOWN_ERROR:
            alert("Save event error: An unknown error occurred");
            break;
        case error.INVALID_ARGUMENT_ERROR:
            alert("Save event error: Invalid argument");
            break;
        case error.PERMISSION_DENIED_ERROR:
            alert("Save event error: Permission denied error");
            break;
        default:
            alert("Save event error: other error, code=" + error.code);
    }
}
            

UNKNOWN_ERROR

An unknown error occurred.

Synopsis:

constant
Number CalendarError.UNKOWN_ERROR = 0

INVALID_ARGUMENT_ERROR

A parameter was incorrect.

Synopsis:

constant
Number CalendarError.INVALID_ARGUMENT_ERROR = 1

TIMEOUT_ERROR

The operation timed out.

Synopsis:

constant
Number CalendarError.TIMEOUT_ERROR = 2

PENDING_OPERATION_ERROR

The operation failed because a previous operation is pending.

Synopsis:

constant
Number CalendarError.PENDING_OPERATION_ERROR = 3

IO_ERROR

An IO error occurred.

Synopsis:

constant
Number CalendarError.IO_ERROR = 4

NOT_SUPPORTED_ERROR

The operation is not supported.

Synopsis:

constant
Number CalendarError.NOT_SUPPORTED_ERROR = 5

PERMISSION_DENIED_ERROR

The operation failed due to insufficient permissions.

Synopsis:

constant
Number CalendarError.PERMISSION_DENIED_ERROR = 20

Last modified: 2014-10-09



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus