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 /opendc/util | |
| parent | bb53cf703f87da8145196406e3ac81b3f0a1d579 (diff) | |
Fix error handling in HTTP requests
Now return the proper status code instead of 500
Diffstat (limited to 'opendc/util')
| -rw-r--r-- | opendc/util/rest.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/opendc/util/rest.py b/opendc/util/rest.py index 65747762..ad53f084 100644 --- a/opendc/util/rest.py +++ b/opendc/util/rest.py @@ -13,11 +13,14 @@ with open(sys.argv[1]) as file: class Request(object): """WebSocket message to REST request mapping.""" - def __init__(self, message): + def __init__(self, message=None): """"Initialize a Request from a socket message.""" # Get the Request parameters from the message + if message is None: + return + try: self.message = message |
