From a679ce149cd78ee4a010a43e0c4f9f4fedf76ffe Mon Sep 17 00:00:00 2001
From: acpaquette <acpaquette@usgs.gov>
Date: Fri, 17 Nov 2023 09:29:12 -0700
Subject: [PATCH] Error Report Fix for Program Launcher (#5331)

* Removed line that gets class, it is derived from the code

* Added more detailed error around itime not finding the leapsecond kernel

* Added changelog entry
---
 CHANGELOG.md                                           | 1 +
 isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp | 1 -
 isis/src/base/objs/iTime/iTime.cpp                     | 9 ++++++++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 69aca1ab47..ce6c03c170 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -70,6 +70,7 @@ release.
 - Fixed target name translation for any dawn images with target "4 CERES" [#5294](https://github.com/DOI-USGS/ISIS3/pull/5294)
 - Fixed exception pop ups in qview when viewing images created using the CSM Camera [#5259](https://github.com/DOI-USGS/ISIS3/pull/5295/files)
 - Fixed shadowtau input file parseing errors when using example file [#5316](https://github.com/DOI-USGS/ISIS3/pull/5316)
+- Fixed ProgramLauncher failing while reporting errors from launched programs [#5331](https://github.com/DOI-USGS/ISIS3/pull/5331)
 
 ## [8.0.1] - 2023-08-23
 
diff --git a/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp b/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp
index 84af06cada..08cb8ed0f4 100644
--- a/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp
+++ b/isis/src/base/objs/ProgramLauncher/ProgramLauncher.cpp
@@ -178,7 +178,6 @@ namespace Isis {
 
       for(int i = 0; i < errorPvl.groups(); i++) {
         PvlGroup &g = errorPvl.group(i);
-        QString eclass = g["Class"];
         QString emsg = g["Message"];
         int ecode = g["Code"];
         QString efile = g["File"];
diff --git a/isis/src/base/objs/iTime/iTime.cpp b/isis/src/base/objs/iTime/iTime.cpp
index ac3b593964..5a30402785 100644
--- a/isis/src/base/objs/iTime/iTime.cpp
+++ b/isis/src/base/objs/iTime/iTime.cpp
@@ -478,9 +478,16 @@ namespace Isis {
     QString baseDir = dataDir["Base"];
     baseDir += "/kernels/lsk/";
     FileName leapSecond(baseDir + "naif????.tls");
+    QString leapSecondName;
+    try {
+      leapSecondName = QString(leapSecond.highestVersion().expanded());
+    }
+    catch (IException &e) {
+      QString msg = "Unable to load leadsecond file. Either the data area is not set or there are no naif####.tls files present";
+      throw IException(e, IException::User, msg, _FILEINFO_);
+    }
 
     NaifStatus::CheckErrors();
-    QString leapSecondName(leapSecond.highestVersion().expanded());
     furnsh_c(leapSecondName.toLatin1().data());
     NaifStatus::CheckErrors();
 
-- 
GitLab