Loading isis/src/base/objs/Application/Application.cpp +32 −8 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ find files of those names at the top level of this repository. **/ extern int errno; #include <fstream> //#include <stdlib.h> //#include <QString> #include <iostream> #include <sstream> Loading @@ -28,12 +26,9 @@ extern int errno; #include <QTime> #include "Application.h" #include "Constants.h" //is this still used in this class? #include "CubeManager.h" #include "FileName.h" #include "IException.h" #include "IString.h" #include "Gui.h" //is this still used? #include "Message.h" #include "Preference.h" #include "ProgramLauncher.h" Loading Loading @@ -625,6 +620,12 @@ namespace Isis { */ int Application::FunctionError(IException &e) { Pvl errors = e.toPvl(); for (int i = 0; i < errors.groups(); i++) { PvlGroup &group = errors.group(i); if (group.isNamed("Error")) { group += PvlKeyword("Program", Application::Name()); } } SessionLog::TheLog().AddError(errors); SessionLog::TheLog().Write(); Loading @@ -632,13 +633,13 @@ namespace Isis { SendParentErrors(errors); } else if (p_ui->IsInteractive()) { p_ui->TheGui()->LoadMessage(e.toString()); p_ui->TheGui()->LoadMessage(Application::formatError(e)); } else if (SessionLog::TheLog().TerminalOutput()) { cerr << SessionLog::TheLog() << endl; } else { cerr << e.toString() << endl; cerr << Application::formatError(e) << endl; } // If debugging flag on write debugging log Loading Loading @@ -706,7 +707,7 @@ namespace Isis { * @param e The Isis::iException */ void Application::GuiReportError(IException &e) { QString errorMessage = e.toString(); QString errorMessage = Application::formatError(e); if (errorMessage == "") { p_ui->TheGui()->ProgressText("Stopped"); } Loading @@ -719,6 +720,29 @@ namespace Isis { exit(0); } QString Application::formatError(IException &e) { stringstream stringStream; QString stringErrors = e.toString(Preference::Preferences().reportFileLine()); if (Preference::Preferences().outputErrorAsPvl()) { stringStream << stringErrors; Pvl errors; stringStream >> errors; for (int i = 0; i < errors.groups(); i++) { PvlGroup &group = errors.group(i); if (group.isNamed("Error")) { group += PvlKeyword("Program", Application::Name()); } } stringStream.str(std::string()); stringStream.clear(); stringStream << errors; stringErrors = stringStream.str().c_str(); } return stringErrors; } QString Application::p_appName("Unknown"); //!< /** * Returns the name of the application. Returns 'Unknown' if the application Loading isis/src/base/objs/Application/Application.h +1 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ namespace Isis { static void GuiLog(const PvlGroup &results); static void GuiLog(const QString &results); static QString Name(); static QString formatError(IException &e); static bool p_applicationForceGuiApp; Loading isis/src/base/objs/Application/Application.truth +63 −15 Original line number Diff line number Diff line Loading @@ -6,12 +6,12 @@ Group = Accounting End_Group Object = unittest IsisVersion = "4.4.0 | 2021-02-19" IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/kelvin/repos/isisbuild/unitTest ExecutionDateTime = 2021-02-19T15:42:42 HostName = Unknown UserName = kelvin ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters Loading @@ -35,13 +35,24 @@ In myFunct **PROGRAMMER ERROR** testing an error. **PROGRAMMER ERROR** local test error. Group = Error Class = "PROGRAMMER ERROR" Code = 3 Message = "local test error" File = unitTest.cpp Line = 27 Program = ./unitTest End_Group End Object = unittest IsisVersion = "4.4.0 | 2021-02-19" IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/kelvin/repos/isisbuild/unitTest ExecutionDateTime = 2021-02-19T15:42:42 HostName = Unknown UserName = kelvin ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters Loading @@ -64,12 +75,12 @@ Object = unittest End_Object Object = unittest IsisVersion = "4.4.0 | 2021-02-19" IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/kelvin/repos/isisbuild/unitTest ExecutionDateTime = 2021-02-19T15:42:42 HostName = Unknown UserName = kelvin ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters Loading @@ -91,12 +102,49 @@ Object = unittest End_Group Group = Error Class = "PROGRAMMER ERROR" Code = 3 Message = "testing an error" File = unitTest.cpp Line = 22 Program = ./unitTest End_Group End_Object Object = unittest IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters FROM = unitTest.cub TO = $temporary/isisprocess_01.cub TO2 = $temporary/isisprocess_02.cub TO3 = $temporary/isisprocess_03.cub TO4 = $temporary/isisprocess_04.cub End_Group Group = Accounting ConnectTime = 00:00:00.0 CpuTime = 00:00:00.0 End_Group Group = Accounting ConnectTime = 00:00:00.0 CpuTime = 00:00:00.0 End_Group Group = Error Class = "PROGRAMMER ERROR" Code = 3 Message = "testing an error" File = unitTest.cpp Line = 22 Program = ./unitTest End_Group End_Object End isis/src/base/objs/Application/unitTest.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,24 @@ void myError() { throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } void errorFormatting() { QString msg = "local test error"; Isis::IException exception = Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); // Add test for formatError Isis::Pvl &prefs = Isis::Preference::Preferences(); Isis::PvlGroup &errorPrefs = prefs.findGroup("ErrorFacility"); QString errorString = Isis::Application::formatError(exception); std::cout << errorString.toStdString() << std::endl; QString &formatValue = errorPrefs["Format"][0]; formatValue = "Pvl"; errorString = Isis::Application::formatError(exception); std::cout << errorString.toStdString() << std::endl; } using namespace std; int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); Loading Loading @@ -62,6 +80,9 @@ int main(int argc, char *argv[]) { a.Run(myError); std::cout << std::endl; a.Run(errorFormatting); std::cout << std::endl; Isis::Pvl p("print.prt"); std::cout << p << std::endl; Loading Loading
isis/src/base/objs/Application/Application.cpp +32 −8 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ find files of those names at the top level of this repository. **/ extern int errno; #include <fstream> //#include <stdlib.h> //#include <QString> #include <iostream> #include <sstream> Loading @@ -28,12 +26,9 @@ extern int errno; #include <QTime> #include "Application.h" #include "Constants.h" //is this still used in this class? #include "CubeManager.h" #include "FileName.h" #include "IException.h" #include "IString.h" #include "Gui.h" //is this still used? #include "Message.h" #include "Preference.h" #include "ProgramLauncher.h" Loading Loading @@ -625,6 +620,12 @@ namespace Isis { */ int Application::FunctionError(IException &e) { Pvl errors = e.toPvl(); for (int i = 0; i < errors.groups(); i++) { PvlGroup &group = errors.group(i); if (group.isNamed("Error")) { group += PvlKeyword("Program", Application::Name()); } } SessionLog::TheLog().AddError(errors); SessionLog::TheLog().Write(); Loading @@ -632,13 +633,13 @@ namespace Isis { SendParentErrors(errors); } else if (p_ui->IsInteractive()) { p_ui->TheGui()->LoadMessage(e.toString()); p_ui->TheGui()->LoadMessage(Application::formatError(e)); } else if (SessionLog::TheLog().TerminalOutput()) { cerr << SessionLog::TheLog() << endl; } else { cerr << e.toString() << endl; cerr << Application::formatError(e) << endl; } // If debugging flag on write debugging log Loading Loading @@ -706,7 +707,7 @@ namespace Isis { * @param e The Isis::iException */ void Application::GuiReportError(IException &e) { QString errorMessage = e.toString(); QString errorMessage = Application::formatError(e); if (errorMessage == "") { p_ui->TheGui()->ProgressText("Stopped"); } Loading @@ -719,6 +720,29 @@ namespace Isis { exit(0); } QString Application::formatError(IException &e) { stringstream stringStream; QString stringErrors = e.toString(Preference::Preferences().reportFileLine()); if (Preference::Preferences().outputErrorAsPvl()) { stringStream << stringErrors; Pvl errors; stringStream >> errors; for (int i = 0; i < errors.groups(); i++) { PvlGroup &group = errors.group(i); if (group.isNamed("Error")) { group += PvlKeyword("Program", Application::Name()); } } stringStream.str(std::string()); stringStream.clear(); stringStream << errors; stringErrors = stringStream.str().c_str(); } return stringErrors; } QString Application::p_appName("Unknown"); //!< /** * Returns the name of the application. Returns 'Unknown' if the application Loading
isis/src/base/objs/Application/Application.h +1 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ namespace Isis { static void GuiLog(const PvlGroup &results); static void GuiLog(const QString &results); static QString Name(); static QString formatError(IException &e); static bool p_applicationForceGuiApp; Loading
isis/src/base/objs/Application/Application.truth +63 −15 Original line number Diff line number Diff line Loading @@ -6,12 +6,12 @@ Group = Accounting End_Group Object = unittest IsisVersion = "4.4.0 | 2021-02-19" IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/kelvin/repos/isisbuild/unitTest ExecutionDateTime = 2021-02-19T15:42:42 HostName = Unknown UserName = kelvin ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters Loading @@ -35,13 +35,24 @@ In myFunct **PROGRAMMER ERROR** testing an error. **PROGRAMMER ERROR** local test error. Group = Error Class = "PROGRAMMER ERROR" Code = 3 Message = "local test error" File = unitTest.cpp Line = 27 Program = ./unitTest End_Group End Object = unittest IsisVersion = "4.4.0 | 2021-02-19" IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/kelvin/repos/isisbuild/unitTest ExecutionDateTime = 2021-02-19T15:42:42 HostName = Unknown UserName = kelvin ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters Loading @@ -64,12 +75,12 @@ Object = unittest End_Object Object = unittest IsisVersion = "4.4.0 | 2021-02-19" IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/kelvin/repos/isisbuild/unitTest ExecutionDateTime = 2021-02-19T15:42:42 HostName = Unknown UserName = kelvin ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters Loading @@ -91,12 +102,49 @@ Object = unittest End_Group Group = Error Class = "PROGRAMMER ERROR" Code = 3 Message = "testing an error" File = unitTest.cpp Line = 22 Program = ./unitTest End_Group End_Object Object = unittest IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest ExecutionDateTime = 2023-07-18T16:56:19 HostName = x86_64-apple-darwin13.4.0 UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters FROM = unitTest.cub TO = $temporary/isisprocess_01.cub TO2 = $temporary/isisprocess_02.cub TO3 = $temporary/isisprocess_03.cub TO4 = $temporary/isisprocess_04.cub End_Group Group = Accounting ConnectTime = 00:00:00.0 CpuTime = 00:00:00.0 End_Group Group = Accounting ConnectTime = 00:00:00.0 CpuTime = 00:00:00.0 End_Group Group = Error Class = "PROGRAMMER ERROR" Code = 3 Message = "testing an error" File = unitTest.cpp Line = 22 Program = ./unitTest End_Group End_Object End
isis/src/base/objs/Application/unitTest.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,24 @@ void myError() { throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } void errorFormatting() { QString msg = "local test error"; Isis::IException exception = Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); // Add test for formatError Isis::Pvl &prefs = Isis::Preference::Preferences(); Isis::PvlGroup &errorPrefs = prefs.findGroup("ErrorFacility"); QString errorString = Isis::Application::formatError(exception); std::cout << errorString.toStdString() << std::endl; QString &formatValue = errorPrefs["Format"][0]; formatValue = "Pvl"; errorString = Isis::Application::formatError(exception); std::cout << errorString.toStdString() << std::endl; } using namespace std; int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); Loading Loading @@ -62,6 +80,9 @@ int main(int argc, char *argv[]) { a.Run(myError); std::cout << std::endl; a.Run(errorFormatting); std::cout << std::endl; Isis::Pvl p("print.prt"); std::cout << p << std::endl; Loading