[WIP] Python: rest_api error handling is removed, comments are added
This commit is contained in:
parent
baaee5643c
commit
5f65385207
1 changed files with 3 additions and 9 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue