fix: 'Error' implementation
This commit is contained in:
@@ -54,8 +54,10 @@ class Response[T]:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
data = dict()
|
data = dict()
|
||||||
data['id'] = self.id
|
data['id'] = self.id
|
||||||
if isinstance(self.inner, Error): data['error'] = self.inner.response()
|
if isinstance(self.inner, Error):
|
||||||
else: data['result'] = self.inner
|
data['error'] = self.inner.response()
|
||||||
|
else:
|
||||||
|
data['result'] = self.inner
|
||||||
return json.dumps(data)
|
return json.dumps(data)
|
||||||
|
|
||||||
class Error(Enum):
|
class Error(Enum):
|
||||||
@@ -65,8 +67,8 @@ class Error(Enum):
|
|||||||
INVALID_PARAMS = -32602
|
INVALID_PARAMS = -32602
|
||||||
INTERNAL_ERROR = -32603
|
INTERNAL_ERROR = -32603
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, *args):
|
||||||
super().__init__()
|
super().__init__(args)
|
||||||
self.data = None
|
self.data = None
|
||||||
|
|
||||||
def message(self) -> str:
|
def message(self) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user