From a6457d2c0a2526bdf2a8c512b620e0c30a19c26b Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Mon, 9 Jan 2017 19:58:05 -0500 Subject: [PATCH] detect authentication error and warn accordingly --- lbrynet/lbrynet_daemon/DaemonCLI.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lbrynet/lbrynet_daemon/DaemonCLI.py b/lbrynet/lbrynet_daemon/DaemonCLI.py index f94d83cfc..a153637c0 100644 --- a/lbrynet/lbrynet_daemon/DaemonCLI.py +++ b/lbrynet/lbrynet_daemon/DaemonCLI.py @@ -7,7 +7,8 @@ from lbrynet import conf from lbrynet.lbrynet_daemon.auth.client import JSONRPCException, LBRYAPIClient from lbrynet.lbrynet_daemon.Daemon import LOADING_WALLET_CODE from jsonrpc.common import RPCError -from urllib2 import URLError +from urllib2 import URLError, HTTPError +from httplib import UNAUTHORIZED def main(): @@ -33,9 +34,13 @@ def main(): try: status = api.status() - except URLError: - print_error("Could not connect to daemon. Are you sure it's running?", - suggest_help=False) + except URLError as err: + if isinstance(err, HTTPError) and err.code == UNAUTHORIZED: + print_error("Daemon requires authentication, but none was provided.", + suggest_help=False) + else: + print_error("Could not connect to daemon. Are you sure it's running?", + suggest_help=False) return 1 if status['startup_status']['code'] != "started":