detect authentication error and warn accordingly
This commit is contained in:
parent
5c429e15bd
commit
a6457d2c0a
1 changed files with 9 additions and 4 deletions
|
@ -7,7 +7,8 @@ from lbrynet import conf
|
||||||
from lbrynet.lbrynet_daemon.auth.client import JSONRPCException, LBRYAPIClient
|
from lbrynet.lbrynet_daemon.auth.client import JSONRPCException, LBRYAPIClient
|
||||||
from lbrynet.lbrynet_daemon.Daemon import LOADING_WALLET_CODE
|
from lbrynet.lbrynet_daemon.Daemon import LOADING_WALLET_CODE
|
||||||
from jsonrpc.common import RPCError
|
from jsonrpc.common import RPCError
|
||||||
from urllib2 import URLError
|
from urllib2 import URLError, HTTPError
|
||||||
|
from httplib import UNAUTHORIZED
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -33,9 +34,13 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
status = api.status()
|
status = api.status()
|
||||||
except URLError:
|
except URLError as err:
|
||||||
print_error("Could not connect to daemon. Are you sure it's running?",
|
if isinstance(err, HTTPError) and err.code == UNAUTHORIZED:
|
||||||
suggest_help=False)
|
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
|
return 1
|
||||||
|
|
||||||
if status['startup_status']['code'] != "started":
|
if status['startup_status']['code'] != "started":
|
||||||
|
|
Loading…
Reference in a new issue