Skip to content

Commit 07230cf

Browse files
fix error message when SF_AUTH_SOCKET_ADDR was set (#2332)
Co-authored-by: Mikołaj Kubik <[email protected]>
1 parent 16cd655 commit 07230cf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/snowflake/connector/auth/webbrowser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,19 @@ def prepare(
124124
socket_connection.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
125125

126126
try:
127+
hostname = os.getenv("SF_AUTH_SOCKET_ADDR", "localhost")
127128
try:
128129
socket_connection.bind(
129130
(
130-
os.getenv("SF_AUTH_SOCKET_ADDR", "localhost"),
131+
hostname,
131132
int(os.getenv("SF_AUTH_SOCKET_PORT", 0)),
132133
)
133134
)
134135
except socket.gaierror as ex:
135136
if ex.args[0] == socket.EAI_NONAME:
136137
raise OperationalError(
137-
msg="localhost is not found. Ensure /etc/hosts has "
138-
"localhost entry.",
138+
msg=f"{hostname} is not found. Ensure /etc/hosts has "
139+
f"{hostname} entry.",
139140
errno=ER_NO_HOSTNAME_FOUND,
140141
)
141142
else:

0 commit comments

Comments
 (0)