[WIP] Python: rest_api error handling is removed, comments are added

This commit is contained in:
Dmitry Kokorin 2021-06-30 19:00:57 +03:00
parent baaee5643c
commit 5f65385207

View file

@ -53,6 +53,7 @@ class MethodRegistry:
if payload:
payload = json.loads(payload)
#It would be essential to validate JSON schema here
f_result = f(f_self, payload)
@ -72,16 +73,9 @@ class RestAPI:
def _process_request(self, method, url, payload):
methods = self.registry.methods[method]
if url in methods.keys():
# try:
# return methods[url](self, payload)
# except json.JSONDecodeError:
# return 'Bad request'
# finally:
# return 'Internal server error'
# else:
# return 'Not found'
#It would be natural to handle exceptions here
if url in methods.keys():
return methods[url](self, payload)
def get(self, url, payload=None):