#10 Handle excepcions un /results and /results/{id} queries
Closed 5 years ago by jskladan. Opened 5 years ago by jlanda.
taskotron/ jlanda/resultsdb_frontend fix-latest  into  develop

@@ -78,7 +78,10 @@ 

  @main.route('/results')

  def results():

      args = dict(request.args)

-     results = RDB_API.get_results(**args)

+     try:

+         results = RDB_API.get_results(**args)

+     except ResultsDBapiException as e:

+         return str(e)

      for result in results['data']:

          result['groups'] = (len(result['groups']), ','.join(result['groups']))

      return render_template('results.html', results = results)
@@ -89,7 +92,10 @@ 

          result = RDB_API.get_result(id = result_id)

      except ResultsDBapiException as e:

          return str(e)

-     result['groups'] = (len(result['groups']), ','.join(result['groups']))

+     try:

+         result['groups'] = (len(result['groups']), ','.join(result['groups']))

+     except KeyError as e:

+         return 'unsupported query'

      return render_template('result_detail.html', result = result)

  

  @main.route('/testcases')

Returns an 400 error on unsupported queries to /latest controller.

Fixes #7

@lbrabec, can you please review this?

Metadata Update from @kparal:
- Request assigned

5 years ago

Don't merge this yet.

Coding #11 I realized that since parsing errors generate a different exception and is not (yet) handled on the except block.

I'll update this PR tonight with handling of both parsing errors

PR updated with the new except

Please move the return render_tepmlate(...) out of the try-except block.
Othervise, it is probably an OK hotfix, but I=E2=80=99d still rather see the=
frontend showing the /latest results correctly. When marking the issue as f=
ixed, please create a new one to track it. Thx.=

Actually I moved that yesterday, It seems that I forgot to force de push on my PR branch :D.

I'll post a new PR tonight

rebased onto 1a82c21

5 years ago

Now the PR handles exceptions on /results/{id} (/latest parsing error ) and /results (resultsdb api error)

Pull-Request has been closed by jskladan

5 years ago
Metadata