Compare commits

...

3 Commits
0.16 ... 0.17

Author SHA1 Message Date
Pawel Kierski
d73d048ff7 Increment version to 0.17 2019-03-12 16:10:23 +01:00
Aliaksei Paulouski
e06e40f845 Fix duplicated error code 2019-03-12 15:53:42 +01:00
Paweł Kierski
833e6999d7 Return JSON-RPC reponse on generic Exception 2019-03-12 15:38:22 +01:00
3 changed files with 10 additions and 7 deletions

View File

@@ -1,8 +1,6 @@
from galaxy.api.jsonrpc import ApplicationError
from galaxy.api.jsonrpc import ApplicationError, UnknownError
class UnknownError(ApplicationError):
def __init__(self, data=None):
super().__init__(0, "Unknown error", data)
UnknownError = UnknownError
class AuthenticationRequired(ApplicationError):
def __init__(self, data=None):

View File

@@ -25,7 +25,7 @@ class MethodNotFound(JsonRpcError):
class InvalidParams(JsonRpcError):
def __init__(self):
super().__init__(-32601, "Invalid params")
super().__init__(-32602, "Invalid params")
class Timeout(JsonRpcError):
def __init__(self):
@@ -41,6 +41,10 @@ class ApplicationError(JsonRpcError):
raise ValueError("The error code in reserved range")
super().__init__(code, message, data)
class UnknownError(ApplicationError):
def __init__(self, data=None):
super().__init__(0, "Unknown error", data)
Request = namedtuple("Request", ["method", "params", "id"], defaults=[{}, None])
Method = namedtuple("Method", ["callback", "internal", "sensitive_params"])
@@ -171,8 +175,9 @@ class Server():
self._send_error(request.id, MethodNotFound())
except JsonRpcError as error:
self._send_error(request.id, error)
except Exception: #pylint: disable=broad-except
except Exception as e: #pylint: disable=broad-except
logging.exception("Unexpected exception raised in plugin handler")
self._send_error(request.id, UnknownError(str(e)))
asyncio.create_task(handle())

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="galaxy.plugin.api",
version="0.16",
version="0.17",
description="Galaxy python plugin API",
author='Galaxy team',
author_email='galaxy@gog.com',