Error handling

This commit is contained in:
Emily 2019-03-11 07:28:53 +01:00
parent 416d7fdd6d
commit fa152f4d46

View File

@ -29,10 +29,6 @@ class handler(asyncTornado.asyncRequestHandler):
args_filter = asyncTornado.check_arguments(self.request.arguments, ARGS)
if False in args_filter:
raise Exception("Missing required arguments")
print()
print(args_filter)
print()
method = args_filter[0]
method_value = self.request.arguments[method]
@ -54,10 +50,8 @@ class handler(asyncTornado.asyncRequestHandler):
except Exception as e:
status_code = 400
data["status"] = status_code
data["message"] = e
data["message"] = str(e)
finally:
print(data)
self.write( json.dumps(data) )
self.set_header("Content-Type", "application/json")
self.set_status(status_code)