Currently when we fail to lookup quotas via /api/v1/subscription/plan/info, we treat all lookups failure the same in thunderbird_accounts/subscription/views.py around line 280: We log at the error level (which notifies Sentry) and we return a generic failure message to the user.
There's one known case that we should handle differently which would address a common Sentry error and provide a clearer error message to users:
The app may throw the specific AccountNotFoundError. First, it would be useful to research how this state arises. Maybe a user logged in but in they are offboarding, so the Stalwart account is gone but their session still there?
Assuming we find that this is a state we expect to happen sometimes, then we should handle it different:
- Log at the warning level instead of error
- Update the JSON response with a more specific error: "User not found". Consider status=404 instead of 500 in this case, since it's not a server error.
Sentry Issue: THUNDERBIRD-ACCOUNTS-7J
Error getting used quota: AccountNotFoundError: [email]
Currently when we fail to lookup quotas via /api/v1/subscription/plan/info, we treat all lookups failure the same in thunderbird_accounts/subscription/views.py around line 280: We log at the error level (which notifies Sentry) and we return a generic failure message to the user.
There's one known case that we should handle differently which would address a common Sentry error and provide a clearer error message to users:
The app may throw the specific
AccountNotFoundError. First, it would be useful to research how this state arises. Maybe a user logged in but in they are offboarding, so the Stalwart account is gone but their session still there?Assuming we find that this is a state we expect to happen sometimes, then we should handle it different:
Sentry Issue: THUNDERBIRD-ACCOUNTS-7J