Skip to content

Commit f972705

Browse files
committed
Holder checks for 401
1 parent 7f5cd78 commit f972705

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pyArango/connection.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@ def __init__(self, session, fct) :
1717
def __call__(self, *args, **kwargs) :
1818
if self.session.auth :
1919
kwargs["auth"] = self.session.auth
20-
return self.fct(*args, **kwargs)
20+
21+
try :
22+
ret = self.fct(*args, **kwargs)
23+
except :
24+
print ("===\nUnable to establish connection, perhaps arango is not running.\n===")
25+
raise
26+
27+
if ret.status_code == 401 :
28+
raise ConnectionError("Unauthorized access, you must supply a username and a password", ret.url, ret.status_code, ret.content)
29+
30+
return ret
2131

2232
def __init__(self, username, password) :
2333
if username and password :

0 commit comments

Comments
 (0)