Skip to content

MNT: Add retry logic and better exception handling#294

Merged
greglucas merged 1 commit intoIMAP-Science-Operations-Center:mainfrom
greglucas:connection-failures
Feb 9, 2026
Merged

MNT: Add retry logic and better exception handling#294
greglucas merged 1 commit intoIMAP-Science-Operations-Center:mainfrom
greglucas:connection-failures

Conversation

@greglucas
Copy link
Contributor

@greglucas greglucas commented Feb 9, 2026

Change Summary

Retry logic following documentation here: https://docs.python-requests.org/en/latest/api/#requests.adapters.HTTPAdapter

There is no status code on a non-http response, so better handle that so we don't get an exception raised from within the exception.

closes #295

@greglucas greglucas requested a review from tech3371 February 9, 2026 16:39
@greglucas greglucas self-assigned this Feb 9, 2026
@greglucas greglucas requested a review from lacoak21 February 9, 2026 17:56
Copy link
Contributor

@lacoak21 lacoak21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix. I have seem that

except requests.exceptions.RequestException as e:
error_msg = f"{e.response.status_code} {e.response.reason}: {e.response.text}"
raise IMAPDataAccessError(error_msg) from e
# Handle cases where response may not exist (connection errors, timeouts, etc.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - Ive definitely seen that happen before and thought it was due to something else

@greglucas greglucas merged commit 5027a6e into IMAP-Science-Operations-Center:main Feb 9, 2026
36 of 46 checks passed
@greglucas greglucas deleted the connection-failures branch February 9, 2026 18:13
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.

Better handle connection failures

2 participants