Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add another except for any OAuth2Errors #540

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backend/src/appointment/routes/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os

from oauthlib.oauth2 import OAuth2Error
from requests import HTTPError
from sentry_sdk import capture_exception
from sqlalchemy.exc import SQLAlchemyError
Expand Down Expand Up @@ -432,13 +433,21 @@ def decide_on_schedule_availability_slot(
if os.getenv('SENTRY_DSN') != '':
capture_exception(err)

# Notify the organizer that the meeting link could not be created!
background_tasks.add_task(send_zoom_meeting_failed_email, to=subscriber.preferred_email, appointment_title=schedule.name)
except OAuth2Error as err:
logging.error('OAuth flow error during zoom meeting creation: ', err)
if os.getenv('SENTRY_DSN') != '':
capture_exception(err)

# Notify the organizer that the meeting link could not be created!
background_tasks.add_task(send_zoom_meeting_failed_email, to=subscriber.preferred_email, appointment_title=schedule.name)
except SQLAlchemyError as err: # Not fatal, but could make things tricky
logging.error('Failed to save the zoom meeting link to the appointment: ', err)
if os.getenv('SENTRY_DSN') != '':
capture_exception(err)


event = schemas.Event(
title=title,
start=slot.start.replace(tzinfo=timezone.utc),
Expand Down