Skip to content

Improve python error handling for backend failures#3767

Open
PE39806 wants to merge 5 commits into
mainfrom
bugfix/bai-2030-improve-python-error-handling-for-backend-failures
Open

Improve python error handling for backend failures#3767
PE39806 wants to merge 5 commits into
mainfrom
bugfix/bai-2030-improve-python-error-handling-for-backend-failures

Conversation

@PE39806

@PE39806 PE39806 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator
  • Update python core to correctly handle non-success responses from the backend
  • Update unit and integration tests
  • Update docs (including Jupyter notebooks) to show how to use the new error handling
  • Bump package version for a new release

Note that this error handling is fully backwards compatible so is not a breaking change.

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation python Pull requests that update Python code tests Improvements or additions to unit tests and / or end to end tests backend Changes affecting server-side logic, APIs, data processing, or internal services. labels Jun 23, 2026
@PE39806 PE39806 removed the backend Changes affecting server-side logic, APIs, data processing, or internal services. label Jun 23, 2026
Comment thread lib/python/src/bailo/core/client.py Outdated
self.url = url.rstrip("/") + "/api"
self.agent = agent or Agent()

def _parse_json(self, res: requests.Response) -> dict[str, Any]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

self looks like a redundant parameter. It isn't accessed. Would it be best to add something to Agent.__request

@PE39806 PE39806 Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good spot. I've opted to make this a @staticmethod rather than moving it into Agent.__request. This avoids changing behaviour for non-JSON responses (e.g. get_download_file) without needing to pass in any extra args or use extra helper functions which might risk this becoming a breaking change.

@github-actions github-actions Bot added the backend Changes affecting server-side logic, APIs, data processing, or internal services. label Jun 24, 2026
@PE39806 PE39806 removed the backend Changes affecting server-side logic, APIs, data processing, or internal services. label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation python Pull requests that update Python code tests Improvements or additions to unit tests and / or end to end tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants