From 8801bbd2f3d1339f5a5ecad48e8f51f68b146604 Mon Sep 17 00:00:00 2001 From: leonoverweel Date: Mon, 3 Apr 2017 09:55:18 +0200 Subject: Fix error handling in HTTP requests Now return the proper status code instead of 500 --- opendc/util/rest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'opendc') 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 -- cgit v1.2.3