Skip to content
Snippets Groups Projects
Commit 9bf9b608 authored by inso's avatar inso
Browse files

Ucoin Errors

parent 70b0367f
Branches
Tags 0.20.1dev4
No related merge requests found
...@@ -26,5 +26,5 @@ import logging ...@@ -26,5 +26,5 @@ import logging
logger = logging.getLogger("ucoin") logger = logging.getLogger("ucoin")
from .api import API, ConnectionHandler, UcoinError from .api import API, ConnectionHandler
from . import network, blockchain, tx, wot, node, ud, ws from . import network, blockchain, tx, wot, node, ud, ws
\ No newline at end of file
...@@ -20,16 +20,9 @@ ...@@ -20,16 +20,9 @@
import aiohttp, json, logging, jsonschema import aiohttp, json, logging, jsonschema
logger = logging.getLogger("ucoin") from ..errors import UcoinError
class UcoinError(Exception): logger = logging.getLogger("ucoin")
"""
UCoin error
"""
def __init__(self, data):
super().__init__("Error code {0} - {1}".format(data["ucode"], data["message"]))
self.error = data
class ConnectionHandler(object): class ConnectionHandler(object):
......
class UcoinError(Exception):
"""
UCoin error
"""
def __init__(self, data):
super().__init__("Error code {0} - {1}".format(data["ucode"], data["message"]))
self.ucode = data["ucode"]
self.message = data["message"]
UNKNOWN = 1001
UNHANDLED = 1002
SIGNATURE_DOES_NOT_MATCH = 1003
ALREADY_UP_TO_DATE = 1004
WRONG_DOCUMENT = 1005
HTTP_PARAM_PUBKEY_REQUIRED = 1101
HTTP_PARAM_IDENTITY_REQUIRED = 1102
HTTP_PARAM_PEER_REQUIRED = 1103
HTTP_PARAM_BLOCK_REQUIRED = 1104
HTTP_PARAM_MEMBERSHIP_REQUIRED = 1105
HTTP_PARAM_TX_REQUIRED = 1106
HTTP_PARAM_SIG_REQUIRED = 1107
HTTP_PARAM_CERT_REQUIRED = 1108
HTTP_PARAM_REVOCATION_REQUIRED = 1109
HTTP_PARAM_CONF_REQUIRED = 1110
NO_MATCHING_IDENTITY = 2001
UID_ALREADY_USED = 2002
PUBKEY_ALREADY_USED = 2003
NO_MEMBER_MATCHING_PUB_OR_UID = 2004
SELF_PEER_NOT_FOUND = 2005
WRONG_SIGNATURE_MEMBERSHIP = 2006
ALREADY_RECEIVED_MEMBERSHIP = 2007
MEMBERSHIP_A_NON_MEMBER_CANNOT_LEAVE = 2008
NOT_A_MEMBER = 2009
NO_CURRENT_BLOCK = 2010
BLOCK_NOT_FOUND = 2011
PEER_NOT_FOUND = 2012
WRONG_UNLOCKER = 2013
LOCKTIME_PREVENT = 2014
SOURCE_ALREADY_CONSUMED = 2015
WRONG_AMOUNTS = 2016
WRONG_OUTPUT_BASE = 2017
CANNOT_ROOT_BLOCK_NO_MEMBERS = 2018
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment