From 141ff565a15563c198606e400a4df98d279f2991 Mon Sep 17 00:00:00 2001 From: Mohit Date: Thu, 2 Apr 2026 01:25:18 +0530 Subject: [PATCH 1/2] Fix unreachable exception handlers by reordering specific exceptions before generic Exception --- API/Classes/Case/DataFileClass.py | 27 +++++++++++++++------------ MUIOGO-ghsa-769x-5pvc-9fg3 | 1 + 2 files changed, 16 insertions(+), 12 deletions(-) create mode 160000 MUIOGO-ghsa-769x-5pvc-9fg3 diff --git a/API/Classes/Case/DataFileClass.py b/API/Classes/Case/DataFileClass.py index bd5cc38b1..22d24a3a4 100644 --- a/API/Classes/Case/DataFileClass.py +++ b/API/Classes/Case/DataFileClass.py @@ -2262,13 +2262,14 @@ def run( self, solver, caserun, lock=None ): return response # urllib.request.urlretrieve(self.dataFile, dataFile) - except Exception as ex: - print(ex) # do whatever you want for debugging. - raise # re-raise exception. - except(IOError, IndexError): - raise IndexError + # Handle specific exceptions first to avoid unreachable handlers + except (IOError, IndexError): + raise except OSError: - raise OSError + raise + except Exception as ex: + print(ex) # do whatever you want for debugging + raise # re-raise exception def generateCSVfromCBC(self, data_file, results_file, base_folder=os.getcwd()): try: @@ -2532,13 +2533,15 @@ def generateCSVfromCBC(self, data_file, results_file, base_folder=os.getcwd()): df_ACI = df_ACI_temp[['r','t','y','AnnualizedInvestmentCost']] df_ACI = df_ACI[df_ACI['AnnualizedInvestmentCost']!=0] df_ACI.to_csv(os.path.join(base_folder, 'csv', 'AnnualizedInvestmentCost.csv'), index=None) - except Exception as ex: - print(ex) # do whatever you want for debugging. - raise # re-raise exception. - except(IOError, IndexError): - raise IndexError + # Handle specific exceptions first to avoid unreachable handlers + except (IOError, IndexError): + raise except OSError: - raise OSError + raise + except Exception as ex: + print(ex) # do whatever you want for debugging + raise # re-raise exception + def generateResultsViewer(self, caserunname): try: diff --git a/MUIOGO-ghsa-769x-5pvc-9fg3 b/MUIOGO-ghsa-769x-5pvc-9fg3 new file mode 160000 index 000000000..68d8e18a6 --- /dev/null +++ b/MUIOGO-ghsa-769x-5pvc-9fg3 @@ -0,0 +1 @@ +Subproject commit 68d8e18a6bbbd36b7c73ffd8d7d50f890b4cda1b From b2c19fa61950d5a5a4c10208e69ec85985254069 Mon Sep 17 00:00:00 2001 From: Mohit Date: Thu, 2 Apr 2026 01:35:14 +0530 Subject: [PATCH 2/2] Remove accidental embedded repository --- MUIOGO-ghsa-769x-5pvc-9fg3 | 1 - 1 file changed, 1 deletion(-) delete mode 160000 MUIOGO-ghsa-769x-5pvc-9fg3 diff --git a/MUIOGO-ghsa-769x-5pvc-9fg3 b/MUIOGO-ghsa-769x-5pvc-9fg3 deleted file mode 160000 index 68d8e18a6..000000000 --- a/MUIOGO-ghsa-769x-5pvc-9fg3 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 68d8e18a6bbbd36b7c73ffd8d7d50f890b4cda1b