catch query KeyError and return an informative message to the user
1 unresolved thread
1 unresolved thread
"fixes": #258 (closed)
now instead of returning a 500 error and emailing the admins, if a user queries gpstimes under the created:
field, they'll now see this on the web:
And this with the API:
Merge request reports
Activity
requested review from @daniel.wysocki
added 1 commit
- 2c5324c2 - unbreak api queries caused by copy/paste error
21 21 htmlEntityStar = "★" 22 22 errorMarker = '<span style="color:red;">'+htmlEntityStar+'</span>' 23 23 24 # Helpful status messages: 25 created_vs_t0 = 'Invalid query. Hint: date queries on the created: field take the form YYYY-MM-DD .. ' \ 26 'YYYY-MM-DD. Date queries with gpstime are supported using the t_0: field' 27 28 29 # Helper function to capture superevent created vs t_0 gpstime queries 30 # and return it to the user: 31 def se_gpstime_parseerror(err): 32 if "ParseResults" in str(err) and 'miltime' in str(err): Good point, I hadn't appreciated the worst case scenario was a 400 error.
Also, playing around with
KeyError
myself, it seems the info instr(err)
is also accessible inerr.args
without doing a conversion tostr
, which has basically the same downsides. So I think we might as well stick to your current implementation.
enabled an automatic merge when the pipeline for a8ac2bed succeeds
Please register or sign in to reply