Skip to content

Commit 9ffaee4

Browse files
committed
Added back some of the better errors
1 parent 9944f78 commit 9ffaee4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/databricks/sql/auth/retry.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,8 @@ def should_retry(self, method: str, status_code: int) -> Tuple[bool, str]:
381381
and self.command_type == CommandType.CLOSE_SESSION
382382
and len(self.history) > 0
383383
):
384-
return (
385-
False,
386-
"CloseSession received 404 code from Databricks. Session is already closed.",
384+
raise SessionAlreadyClosedError(
385+
"CloseSession received 404 code from Databricks. Session is already closed."
387386
)
388387

389388
# Request failed with 404 because CloseOperation returns 404 if you repeat the request.
@@ -392,9 +391,8 @@ def should_retry(self, method: str, status_code: int) -> Tuple[bool, str]:
392391
and self.command_type == CommandType.CLOSE_OPERATION
393392
and len(self.history) > 0
394393
):
395-
return (
396-
False,
397-
"CloseOperation received 404 code from Databricks. Cursor is already closed.",
394+
raise CursorAlreadyClosedError(
395+
"CloseOperation received 404 code from Databricks. Cursor is already closed."
398396
)
399397

400398
# Request failed, was an ExecuteStatement and the command may have reached the server

0 commit comments

Comments
 (0)