electrum-personal-server

Maximally lightweight electrum server for a single user
git clone https://git.parazyd.org/electrum-personal-server
Log | Files | Refs | README

commit 4a0f7338d62a287fc76910be144270c0dc46683a
parent febdaf7b7a5cd2cc3defcec347a9f26fea5c5fe2
Author: chris-belcher <chris-belcher@users.noreply.github.com>
Date:   Thu, 29 Mar 2018 18:34:15 +0100

Made the first json-rpc error message have more detail

Diffstat:
Melectrumpersonalserver/jsonrpc.py | 6+-----
Mserver.py | 4+++-
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/electrumpersonalserver/jsonrpc.py b/electrumpersonalserver/jsonrpc.py @@ -5,11 +5,7 @@ import base64 import http.client import json -class JsonRpcError(Exception): - def __init__(self, obj): - self.code = obj["code"] - self.message = obj["message"] - +class JsonRpcError(Exception): pass class JsonRpcConnectionError(JsonRpcError): pass class JsonRpc(object): diff --git a/server.py b/server.py @@ -2,6 +2,7 @@ import socket, time, json, datetime, struct, binascii, ssl, os.path, platform from configparser import ConfigParser, NoSectionError, NoOptionError +import traceback from electrumpersonalserver.jsonrpc import JsonRpc, JsonRpcError import electrumpersonalserver.hashes as hashes @@ -427,8 +428,9 @@ def main(): while bestblockhash[0] == None: try: bestblockhash[0] = rpc.call("getbestblockhash", []) - except TypeError: + except JsonRpcError as e: if not printed_error_msg: + log("Error: " + repr(e)) log("Error with bitcoin rpc, check host/port/user/password") printed_error_msg = True time.sleep(5)