Error handling
This commit is contained in:
parent
416d7fdd6d
commit
fa152f4d46
|
@ -29,10 +29,6 @@ class handler(asyncTornado.asyncRequestHandler):
|
||||||
args_filter = asyncTornado.check_arguments(self.request.arguments, ARGS)
|
args_filter = asyncTornado.check_arguments(self.request.arguments, ARGS)
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user