Skip to content

Commit

Permalink
[PECO-1961] On non-retryable error, ensure PySQL includes useful info…
Browse files Browse the repository at this point in the history
…rmation in error (#447)

* added error info on non-retryable error
  • Loading branch information
shivam2680 authored Oct 3, 2024
1 parent a151df2 commit 08f14a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/databricks/sql/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 @@ -407,7 +408,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

0 comments on commit 08f14a0

Please sign in to comment.