Skip to content

Commit

Permalink
add exception handling for get_reason
Browse files Browse the repository at this point in the history
  • Loading branch information
nicHoch committed Nov 25, 2024
1 parent 5802e1e commit 0660c6a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions stixcore/io/RidLutManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ def get_reason(self, rid):
str
verbal description of the request purpose
"""
request = self.rid_lut.loc[rid]
reason = " ".join(np.atleast_1d(request['description']))
return reason
try:
request = self.rid_lut.loc[rid]
reason = " ".join(np.atleast_1d(request['description']))
return reason
except IndexError:
logger.warning("can't get request purpose: no request founds for rid: {rid}")
return ""

def get_scaling_factor(self, rid):
"""Gets the trigger descaling factor connected to the BSD request.
Expand Down

0 comments on commit 0660c6a

Please sign in to comment.