mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-16 18:49:04 +00:00
Add API code values to confluent messages
When a message is used that would raise an exception in a singleton case, make available the appropriate apicode in contexts that would be relevant (namely multi-node operations and all asynchttp).
This commit is contained in:
parent
9f0daf324e
commit
7eb881d7e5
@ -59,6 +59,7 @@ def _htmlify_structure(indict):
|
||||
|
||||
|
||||
class ConfluentMessage(object):
|
||||
apicode = 200
|
||||
readonly = False
|
||||
defaultvalue = ''
|
||||
defaulttype = 'text'
|
||||
@ -174,6 +175,8 @@ class ConfluentMessage(object):
|
||||
|
||||
|
||||
class ConfluentNodeError(object):
|
||||
apicode = 500
|
||||
|
||||
def __init__(self, node, errorstr):
|
||||
self.node = node
|
||||
self.error = errorstr
|
||||
@ -191,15 +194,20 @@ class ConfluentNodeError(object):
|
||||
|
||||
|
||||
class ConfluentTargetTimeout(ConfluentNodeError):
|
||||
apicode = 504
|
||||
|
||||
def __init__(self, node, errstr='timeout'):
|
||||
self.node = node
|
||||
self.error = errstr
|
||||
|
||||
|
||||
def strip_node(self, node):
|
||||
raise exc.TargetEndpointUnreachable(self.error)
|
||||
|
||||
|
||||
class ConfluentTargetNotFound(ConfluentNodeError):
|
||||
apicode = 404
|
||||
|
||||
def __init__(self, node, errorstr='not found'):
|
||||
self.node = node
|
||||
self.error = errorstr
|
||||
@ -209,6 +217,7 @@ class ConfluentTargetNotFound(ConfluentNodeError):
|
||||
|
||||
|
||||
class ConfluentTargetInvalidCredentials(ConfluentNodeError):
|
||||
apicode = 502
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
self.error = 'bad credentials'
|
||||
|
Loading…
x
Reference in New Issue
Block a user