Skip to content

Commit badec84

Browse files
committed
Raise ClientError when request fails when trying to log in
1 parent eade994 commit badec84

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mergin/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ def login(self, login, password):
215215
info = json.load(e)
216216
raise LoginError(info.get("detail"))
217217
raise LoginError(e.read().decode("utf-8"))
218+
except urllib.error.URLError as e:
219+
# e.g. when DNS resolution fails (no internet connection?)
220+
raise ClientError("Error trying to log in: " + str(e))
218221
self._auth_session = {
219222
"token": "Bearer %s" % session["token"],
220223
"expire": dateutil.parser.parse(session["expire"])

0 commit comments

Comments
 (0)