Skip to content

Commit

Permalink
Better error handling in select_values
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Nov 17, 2023
1 parent 4f1a012 commit fcc3e4d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions python/rcdb/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,16 @@ def select_runs(self, search_str="", run_min=0, run_max=sys.maxsize, sort_desc=F
if isinstance(value, Condition):
value = (value,)
run = value[0].run
if eval(compiled_search_eval):
sel_runs.append(run)
try:
if eval(compiled_search_eval):
sel_runs.append(run)
except Exception as ex:
message = 'Error evaluating search query.\n' \
+ ' Query: <<"{}">>, \n'.format(search_eval) \
+ ' Names: {}, \n'.format(names) \
+ ' Values: {} \n'.format(values) \
+ ' Error ({}): {}'.format(type(ex), ex)
raise QueryEvaluationError(msg=message)

selection_sw.stop()
result = RunSelectionResult(sel_runs, self)
Expand Down Expand Up @@ -971,7 +979,7 @@ def select_values(self, val_names=None, search_str="", run_min=0, run_max=sys.ma
+ ' Query: <<"{}">>, \n'.format(search_eval) \
+ ' Names: {}, \n'.format(names) \
+ ' Values: {} \n'.format(values) \
+ ' Error: {}'.format(ex)
+ ' Error ({}): {}'.format(type(ex), ex)
raise QueryEvaluationError(msg=message)

selection_sw.stop()
Expand Down

0 comments on commit fcc3e4d

Please sign in to comment.