From 0660c6a854336a0e8a993d0adc7503c658bccc7c Mon Sep 17 00:00:00 2001 From: Nicky Hochmuth Date: Mon, 11 Nov 2024 16:42:18 +0100 Subject: [PATCH] add exception handling for get_reason --- stixcore/io/RidLutManager.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stixcore/io/RidLutManager.py b/stixcore/io/RidLutManager.py index 321b6ea3..51a5f983 100644 --- a/stixcore/io/RidLutManager.py +++ b/stixcore/io/RidLutManager.py @@ -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.