You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Give users a clean way to programatically determine the cause of FailedToRetrieveItemException #129
When receiving a FailedToRetrieveItemException I have no clean programmatic way to know what was the underlying cause.
The message of the exception will provide an HTTP status code, but it is embedded in a full-text message and is more human-friendly than machine friendly.
Use cases
I would like to be able to route exceptions, e.g. to decide whether a failed attempt should be retried. A server-side (e.g. 5XX) error might be transient and is worth retrying, a client-side (e.g. 4XX) error is typically not.
Proposed solution
I can think of two main categories of solutions:
Specific sub-exceptions, e.g. AuhorizationException, AuthenticationException or InvalidRequestException.
Add an additional property to the relevant exception(s), e.g. FailedToRetrieveItemException.http_status.
Is there a workaround to accomplish this today?
I'm using a regex on the exception message to find and extract the HTTP status code.
References & Prior Work
N/A
Extra note
I also noticed that when timing out, an httpx.ConnectTimeout is raised. A OnePassword-SDK-defined exception, e.g. onepasswordconnectsdk.errors.TransportException would probably be cleaner.
Thanks for this feedback, I will log it internally with the team. For the time being I think your current method of regex to extract the HTTP status code is the best approach.
Activity
moward98 commentedon Nov 27, 2025
Hi @ya3xp,
Thanks for this feedback, I will log it internally with the team. For the time being I think your current method of regex to extract the HTTP status code is the best approach.
pass status_code to FailedToRetrieveItemException