Handle errors#
Every error calendaring-sync raises on purpose derives from CalendaringSyncError, and the error reference says what each one means. A step of a sync that fails changes nothing, so you can always sync again, as Guarantees and limits lists.
from calendaring_sync import ScopeGoneError, StaleChangeSetError, StoreBusyError
unsent = []
try:
adapter.sync()
except (StoreBusyError, StaleChangeSetError):
pass # Nothing changed; sync again later.
except ScopeGoneError:
dropped = replica.drop_scope(adapter.scope_id)
unsent = [record.edit.content for record in dropped.pending + dropped.conflicts if record.edit]
The client library’s own errors, such as a refused login, reach you unchanged. Each adapter’s class description names them.