提交 e8625ad4 编写于 作者: A Alessio Sergi

Use ProtocolError.errcode value to trace errors (v2)

上级 90e1124e
......@@ -136,15 +136,14 @@ class GlancesClientBrowser(object):
"Error while grabbing stats form {0}: {1}".format(uri, e))
v['status'] = 'OFFLINE'
except ProtocolError as e:
if str(e).find(" 401 ") > 0:
if e.errcode == 401:
# Error 401 (Authentication failed)
# Password is not the good one...
v['password'] = None
v['status'] = 'PROTECTED'
else:
v['status'] = 'OFFLINE'
logger.debug(
"Cannot grab stats from {0}: {1}".format(uri, e))
logger.debug("Cannot grab stats from {0} ({1} {2})".format(uri, e.errcode, e.errmsg))
else:
# Status
v['status'] = 'ONLINE'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册