Return 404 for unknown tasks
Browse files- api/resources/root.py +5 -1
api/resources/root.py
CHANGED
@@ -15,7 +15,7 @@ class RootResource:
|
|
15 |
self.max_tasks = 5
|
16 |
|
17 |
def on_get(self, request, response):
|
18 |
-
response.text = '
|
19 |
|
20 |
def on_post(self, request, response):
|
21 |
payload = request.media
|
@@ -44,6 +44,10 @@ class RootResource:
|
|
44 |
passed = evaluate_solution(task_id, solution)
|
45 |
|
46 |
response.media = {'passed': passed}
|
|
|
|
|
|
|
|
|
47 |
except Exception as e:
|
48 |
logging.error('Error processing request: {}'.format(str(e)))
|
49 |
response.status = falcon.HTTP_500
|
|
|
15 |
self.max_tasks = 5
|
16 |
|
17 |
def on_get(self, request, response):
|
18 |
+
response.text = 'Human Eval for Solidity Server v1.2410.0'
|
19 |
|
20 |
def on_post(self, request, response):
|
21 |
payload = request.media
|
|
|
44 |
passed = evaluate_solution(task_id, solution)
|
45 |
|
46 |
response.media = {'passed': passed}
|
47 |
+
except FileNotFoundError as e:
|
48 |
+
logging.error('Task not found: {}'.format(str(e)))
|
49 |
+
response.status = falcon.HTTP_404
|
50 |
+
response.media = {'error': 'Task not found'}
|
51 |
except Exception as e:
|
52 |
logging.error('Error processing request: {}'.format(str(e)))
|
53 |
response.status = falcon.HTTP_500
|