Skip to content

fix: keep EmailNotVerified/NoPaymentHistory type in B2Session - #669

Open
patrick-immometrica wants to merge 1 commit into
Backblaze:masterfrom
patrick-immometrica:fix-unauthorized-subclass
Open

patrick-immometrica wants to merge 1 commit into
Backblaze:masterfrom
patrick-immometrica:fix-unauthorized-subclass

Conversation

@patrick-immometrica

Copy link
Copy Markdown

_add_app_key_info_to_unauthorized always returns a plain Unauthorized, so EmailNotVerified and NoPaymentHistory raised by the server lose their type on the way out of B2Session.

Two effects: callers can't catch them, and should_retry_upload() goes back to True. An upload on an account without a verified email or payment history is then retried MAX_UPLOAD_ATTEMPTS times and ends in MaxRetriesExceeded instead of failing with the real error.

The fix keeps the original class. All Unauthorized subclasses that can reach this helper share its (message, code) constructor.

The session rebuilt every Unauthorized as the base class, so
EmailNotVerified and NoPaymentHistory could not be caught and their
should_retry_upload() = False was lost.
@patrick-immometrica
patrick-immometrica marked this pull request as ready for review November 15, 2026 14:24

This branch has not been deployed

No deployments
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