brunneis commited on
Commit
6008bf2
1 Parent(s): 87f281a

Return 404 for unknown tasks

Browse files
Files changed (1) hide show
  1. 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 = 'HES Server v1.2410.0'
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