Error handling

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

View File

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