Skip to content

fix: Tolerate 500-errors on calendar existtence probing#8

Open
tobixen wants to merge 1 commit intomainfrom
refactor/calendar-accessibility-helper
Open

fix: Tolerate 500-errors on calendar existtence probing#8
tobixen wants to merge 1 commit intomainfrom
refactor/calendar-accessibility-helper

Conversation

@tobixen
Copy link
Copy Markdown
Member

@tobixen tobixen commented Mar 21, 2026

Introduced a _calendar_is_accessible(cal) static method on
CheckMakeDeleteCalendar that probes a calendar by calling .events()
and catches DAVError (which covers NotFoundError 404,
AuthorizationError 403, and ReportError 500).

This replaces three inline try/except blocks that had inconsistent
exception coverage — one caught Exception (too broad), two caught
only NotFoundError (too narrow). The trigger was a server that returns
HTTP 500 on a REPORT request for a non-existent calendar, reported at
pycalendar/calendar-cli#114 (comment)

Also simplified _try_make_calendar to return a plain bool instead
of a (bool, exception_or_None) tuple; callers only ever used [0].

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Introduced a `_calendar_is_accessible(cal)` static method on
`CheckMakeDeleteCalendar` that probes a calendar by calling `.events()`
and catches `DAVError` (which covers `NotFoundError` 404,
`AuthorizationError` 403, and `ReportError` 500).

This replaces three inline try/except blocks that had inconsistent
exception coverage — one caught `Exception` (too broad), two caught
only `NotFoundError` (too narrow). The trigger was a server that returns
HTTP 500 on a REPORT request for a non-existent calendar, reported at
pycalendar/calendar-cli#114 (comment)

Also simplified `_try_make_calendar` to return a plain `bool` instead
of a `(bool, exception_or_None)` tuple; callers only ever used `[0]`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant