Skip to content

Commit

Permalink
Moved 401 error into a separate block
Browse files Browse the repository at this point in the history
  • Loading branch information
jprakash-db committed Jun 17, 2024
1 parent 1203a62 commit 594a85a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/databricks/sql/auth/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,13 @@ def should_retry(self, method: str, status_code: int) -> Tuple[bool, str]:
return False, "200 codes are not retried"

# Invalid Credentials error. Don't retry
if status_code == 403 or status_code == 401:
if status_code == 401:
raise NonRecoverableNetworkError(
"Received 401 - FORBIDDEN. Invalid authentication credentials."
)

# Invalid Credentials error. Don't retry
if status_code == 403:
raise NonRecoverableNetworkError(
"Received 403 - FORBIDDEN. Confirm your authentication credentials."
)
Expand Down

0 comments on commit 594a85a

Please sign in to comment.