Skip to content

Commit d072d5e

Browse files
Fix
1 parent 0f0b490 commit d072d5e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/snowflake/connector/network.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,12 +1034,15 @@ def _request_exec_wrapper(
10341034
time.sleep(float(retry_ctx.current_sleep_time))
10351035
retry_ctx.increment()
10361036

1037-
reason = cause.errno if cause.errno is not None else 0
1038-
reason = (
1039-
reason - ER_HTTP_GENERAL_ERROR
1040-
if reason >= ER_HTTP_GENERAL_ERROR
1041-
else reason
1042-
)
1037+
reason = getattr(cause, "errno", 0)
1038+
if reason is None:
1039+
reason = 0
1040+
else:
1041+
reason = (
1042+
reason - ER_HTTP_GENERAL_ERROR
1043+
if reason >= ER_HTTP_GENERAL_ERROR
1044+
else reason
1045+
)
10431046
retry_ctx.retry_reason = reason
10441047

10451048
if "Connection aborted" in repr(e) and "ECONNRESET" in repr(e):

0 commit comments

Comments
 (0)