Skip to content

Commit 594a85a

Browse files
committed
Moved 401 error into a separate block
1 parent 1203a62 commit 594a85a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/databricks/sql/auth/retry.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,13 @@ def should_retry(self, method: str, status_code: int) -> Tuple[bool, str]:
340340
return False, "200 codes are not retried"
341341

342342
# Invalid Credentials error. Don't retry
343-
if status_code == 403 or status_code == 401:
343+
if status_code == 401:
344+
raise NonRecoverableNetworkError(
345+
"Received 401 - FORBIDDEN. Invalid authentication credentials."
346+
)
347+
348+
# Invalid Credentials error. Don't retry
349+
if status_code == 403:
344350
raise NonRecoverableNetworkError(
345351
"Received 403 - FORBIDDEN. Confirm your authentication credentials."
346352
)

0 commit comments

Comments
 (0)