diff options
| author | leonoverweel <l.overweel@gmail.com> | 2017-04-03 09:55:18 +0200 |
|---|---|---|
| committer | leonoverweel <l.overweel@gmail.com> | 2017-04-03 09:55:18 +0200 |
| commit | 8801bbd2f3d1339f5a5ecad48e8f51f68b146604 (patch) | |
| tree | fe0e843321d35d90e5d2402edae1dc65249e0c78 /main.py | |
| parent | bb53cf703f87da8145196406e3ac81b3f0a1d579 (diff) | |
Fix error handling in HTTP requests
Now return the proper status code instead of 500
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -168,7 +168,7 @@ def _process_message(message): response = request.process() return (request, response) - + except exceptions.AuthorizationTokenError as e: response = rest.Response(401, 'Authorization error') response.id = message['id'] @@ -188,6 +188,10 @@ def _process_message(message): response.id = message['id'] traceback.print_exc() - return ({'method': message['method'], 'path': message['path']}, response) + request = rest.Request() + request.method = message['method'] + request.path = message['path'] + + return (request, response) SOCKET_IO_CORE.run(FLASK_CORE_APP, host='0.0.0.0', port=8081) |
