Skip to content

pass status_code to FailedToRetrieveItemException#144

Open
yashpy wants to merge 1 commit into
1Password:mainfrom
yashpy:fix/exception-status-codes
Open

pass status_code to FailedToRetrieveItemException#144
yashpy wants to merge 1 commit into
1Password:mainfrom
yashpy:fix/exception-status-codes

Conversation

@yashpy

@yashpy yashpy commented Jul 24, 2026

Copy link
Copy Markdown

Fixes #129

Copilot AI review requested due to automatic review settings July 24, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to address issue #129 by making FailedToRetrieveItemException more machine-actionable, specifically by ensuring callers can access an HTTP status code without parsing the exception message.

Changes:

  • Pass status_code=response.status_code when raising FailedToRetrieveItemException in get_item_by_title.
  • Pass status_code=response.status_code when raising FailedToRetrieveItemException in get_items.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 179 to 184
except HTTPError:
raise FailedToRetrieveItemException(
f"Unable to retrieve items. Received {response.status_code} \
for {url} with message: {response.json().get('message')}"
for {url} with message: {response.json().get('message')}",
status_code=response.status_code
)
Comment on lines 218 to 223
except HTTPError:
raise FailedToRetrieveItemException(
f"Unable to retrieve items. Received {response.status_code} \
for {url} with message: {response.json().get('message')}"
for {url} with message: {response.json().get('message')}",
status_code=response.status_code
)
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.

Give users a clean way to programatically determine the cause of FailedToRetrieveItemException

2 participants