From 8551d6799e3240bc4fbb64732fa8a79cb59302e9 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 6 Feb 2018 11:34:42 -0500 Subject: [PATCH] Update Ghoul repository (closes #483) Do not let exception leak out of OpenSpaceEngine::create method Add double dash to long name commandline arguments --- apps/OpenSpace/main.cpp | 36 ++++++++++++++++++++++++++++------ ext/ghoul | 2 +- src/engine/openspaceengine.cpp | 11 ++++++----- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 1b2b2f8b48..a4d2a14d5a 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -506,12 +506,36 @@ int main_main(int argc, char** argv) { // @CLEANUP: Replace the return valua with throwing an exception --abock std::vector sgctArguments; bool requestQuit = false; - openspace::OpenSpaceEngine::create( - argc, argv, - std::make_unique(), - sgctArguments, - requestQuit - ); + try { + openspace::OpenSpaceEngine::create( + argc, argv, + std::make_unique(), + sgctArguments, + requestQuit + ); + } + catch (const ghoul::RuntimeError& e) { + // Write out all of the information about the exception and flush the logs + LFATALC(e.component, e.message); + LogMgr.flushLogs(); + return EXIT_FAILURE; + } + catch (const ghoul::AssertionException& e) { + // We don't want to catch the assertion exception as we won't be able to add a + // breakpoint for debugging + LFATALC("Assertion failed", e.what()); + throw; + } + catch (const std::exception& e) { + LFATALC("Exception", e.what()); + LogMgr.flushLogs(); + return EXIT_FAILURE; + } + catch (...) { + LFATALC("Exception", "Unknown exception"); + LogMgr.flushLogs(); + return EXIT_FAILURE; + } if (requestQuit) { return EXIT_SUCCESS; diff --git a/ext/ghoul b/ext/ghoul index e7389ac131..0830bb186a 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit e7389ac131f23df5b7d7982f2a77b5ecff8b9115 +Subproject commit 0830bb186a10f83d4e7d7791b584a1a7235c2e3c diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index eed8aab633..59c5b1a435 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -312,7 +312,7 @@ void OpenSpaceEngine::create(int argc, char** argv, if (!FileSys.fileExists(configurationFilePath)) { throw ghoul::FileNotFoundError( - "Configuration file '" + configurationFilePath + "' not found" + "Configuration file '" + configurationFilePath + "'" ); } LINFO("Configuration Path: '" << configurationFilePath << "'"); @@ -821,26 +821,26 @@ void OpenSpaceEngine::writeStaticDocumentation() { void OpenSpaceEngine::gatherCommandlineArguments() { commandlineArgumentPlaceholders.configurationName = ""; _commandlineParser->addCommand(std::make_unique>( - commandlineArgumentPlaceholders.configurationName, "-config", "-c", + commandlineArgumentPlaceholders.configurationName, "--config", "-c", "Provides the path to the OpenSpace configuration file" )); commandlineArgumentPlaceholders.sgctConfigurationName = ""; _commandlineParser->addCommand(std::make_unique>( - commandlineArgumentPlaceholders.sgctConfigurationName, "-sgct", "-s", + commandlineArgumentPlaceholders.sgctConfigurationName, "--sgct", "-s", "Provides the path to the SGCT configuration file, overriding the value set in " "the OpenSpace configuration file" )); commandlineArgumentPlaceholders.sceneName = ""; _commandlineParser->addCommand(std::make_unique>( - commandlineArgumentPlaceholders.sceneName, "-scene", "", "Provides the path to " + commandlineArgumentPlaceholders.sceneName, "--scene", "", "Provides the path to " "the scene file, overriding the value set in the OpenSpace configuration file" )); commandlineArgumentPlaceholders.cacheFolder = ""; _commandlineParser->addCommand(std::make_unique>( - commandlineArgumentPlaceholders.cacheFolder, "-cacheDir", "", "Provides the " + commandlineArgumentPlaceholders.cacheFolder, "--cacheDir", "", "Provides the " "path to a cache file, overriding the value set in the OpenSpace configuration " "file" )); @@ -1231,6 +1231,7 @@ void OpenSpaceEngine::preSynchronization() { FileSys.triggerFilesystemEvents(); if (_hasScheduledAssetLoading) { + LINFO("Loading asset: " << _scheduledAssetPathToLoad); loadSingleAsset(_scheduledAssetPathToLoad); _hasScheduledAssetLoading = false; _scheduledAssetPathToLoad = "";