Improve namecoin init error handling

- partially addresses #896
This commit is contained in:
Peter Šurda 2016-08-31 16:24:28 +08:00
parent 59dba6a7c7
commit cc90747da1
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -273,9 +273,9 @@ def ensureNamecoinOptions ():
# Try to read user/password from .namecoin configuration file. # Try to read user/password from .namecoin configuration file.
defaultUser = "" defaultUser = ""
defaultPass = "" defaultPass = ""
nmcFolder = lookupNamecoinFolder ()
nmcConfig = nmcFolder + "namecoin.conf"
try: try:
nmcFolder = lookupNamecoinFolder ()
nmcConfig = nmcFolder + "namecoin.conf"
nmc = open (nmcConfig, "r") nmc = open (nmcConfig, "r")
while True: while True:
@ -295,7 +295,8 @@ def ensureNamecoinOptions ():
shared.namecoinDefaultRpcPort = val shared.namecoinDefaultRpcPort = val
nmc.close () nmc.close ()
except IOError:
logger.error("%s unreadable or missing, Namecoin support deactivated", nmcConfig)
except Exception as exc: except Exception as exc:
logger.warning("Error processing namecoin.conf", exc_info=True) logger.warning("Error processing namecoin.conf", exc_info=True)