Skip to content

[PECO-1961] On non-retryable error, ensure PySQL includes useful information in error #447

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

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/databricks/sql/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import logging

BIT_MASKS = [1, 2, 4, 8, 16, 32, 64, 128]
DEFAULT_ERROR_CONTEXT = "Unknown error"

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -357,7 +358,12 @@ def user_friendly_error_message(self, no_retry_reason, attempt, elapsed):
user_friendly_error_message = "{}: {}".format(
user_friendly_error_message, self.error_message
)
return user_friendly_error_message
try:
error_context = str(self.error)
except:
error_context = DEFAULT_ERROR_CONTEXT

return user_friendly_error_message + ". " + error_context


# Taken from PyHive
Expand Down
Loading