Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Improve error handling in python SDK #799

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dsculptor
Copy link

@dsculptor dsculptor commented Oct 23, 2024

Changes

This PR adds a catch-all error handler from API responses in the Databricks SDK for Python.
Also contains minor fixes for error messages.

Tests

  • make test run locally
  • make fmt applied
  • relevant integration tests applied

Same as: #767

@dsculptor dsculptor requested a review from mgyucht October 23, 2024 11:58
@dsculptor dsculptor changed the title Minor fix in error message for generic error [bugfix] Minor fix in error message for generic error Oct 23, 2024
@dsculptor dsculptor force-pushed the raj/minor-fix branch 3 times, most recently from e4098e1 to bfe9b0b Compare October 23, 2024 14:32
@dsculptor dsculptor changed the title [bugfix] Minor fix in error message for generic error [Fix] Minor fix in error message for generic error Oct 23, 2024
@kishaningithub kishaningithub mentioned this pull request Oct 30, 2024
3 tasks
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

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

Thanks @dsculptor.

Let's extend this with one more change. In particular, I want to ensure that any error that is not parsed by any of the current error parsers is still handled in a graceful manner. To do this, let's implement a new error parser that is a catch-all error parser that just sets the entire response body as the message. That way, we never need to use this message in the error directly, as this error parser will always succeed. However, we can still log a message saying that we were unable to parse the error and fell back to this catch-all case.

@@ -38,7 +38,7 @@ def _unknown_error(response: requests.Response) -> str:
return (
'This is likely a bug in the Databricks SDK for Python or the underlying '
'API. Please report this issue with the following debugging information to the SDK issue tracker at '
f'https://github.com/databricks/databricks-sdk-go/issues. Request log:```{request_log}```')
Copy link
Contributor

Choose a reason for hiding this comment

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

Whoops, nice catch!

Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 799
  • Commit SHA: 094addf9fd7435f847f16f0f284ec3ee37699063

Checks will be approved automatically on success.

@eng-dev-ecosystem-bot
Copy link
Collaborator

Test Details: go/deco-tests/12007089624

@dsculptor dsculptor changed the title [Fix] Minor fix in error message for generic error [Enhancement] Improve error handling in python SDK Dec 16, 2024
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.

3 participants