From 389842f76cab6c7a211faa90c3c157a28df24bd6 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 5 Aug 2025 20:43:44 +0200 Subject: [PATCH] Adjust coding style --- ext/ghoul | 2 +- .../documentation/documentationengine.h | 17 ---------- include/openspace/mission/missionmanager.h | 4 --- .../dashboarditemtimevaryingtext.cpp | 3 +- .../pointcloud/renderablepointcloud.cpp | 8 ++--- modules/base/rendering/renderableswitch.cpp | 2 +- .../tasks/kameleonvolumetofieldlinestask.cpp | 2 +- .../src/renderabletimevaryingfitssphere.cpp | 6 ++-- modules/gaia/tasks/readfilejob.cpp | 4 +-- .../tileprovider/singleimagetileprovider.cpp | 6 ++-- .../src/tileprovider/temporaltileprovider.cpp | 3 +- modules/globebrowsing/src/timequantizer.cpp | 12 ++++--- modules/kameleon/src/kameleonwrapper.cpp | 7 ++-- modules/space/kepler.cpp | 6 ++-- .../space/rendering/renderabletravelspeed.cpp | 2 +- .../space/translation/keplertranslation.cpp | 14 +++++--- modules/space/translation/keplertranslation.h | 6 ---- modules/sync/syncs/urlsynchronization.cpp | 3 +- modules/volume/volumegridtype.cpp | 7 +--- modules/volume/volumegridtype.h | 6 ---- src/data/csvloader.cpp | 3 +- src/data/speckloader.cpp | 12 +++---- src/documentation/documentationengine.cpp | 13 +++----- src/engine/openspaceengine.cpp | 2 +- src/interaction/actionmanager_lua.inl | 10 +++--- src/interaction/sessionrecordinghandler.cpp | 32 +++++++++++-------- src/mission/missionmanager.cpp | 12 ++++--- src/rendering/framebufferrenderer.cpp | 6 ++-- src/scene/assetmanager.cpp | 3 +- src/scene/scene_lua.inl | 18 ++++------- 30 files changed, 91 insertions(+), 140 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index e656c0515d..9660f8eee1 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit e656c0515ddfeb0599308a349051a4f912745d58 +Subproject commit 9660f8eee19b9ef4ec689ae73db7fa9da222260e diff --git a/include/openspace/documentation/documentationengine.h b/include/openspace/documentation/documentationengine.h index 8cc76bf509..4b8c08e1bc 100644 --- a/include/openspace/documentation/documentationengine.h +++ b/include/openspace/documentation/documentationengine.h @@ -39,23 +39,6 @@ namespace openspace::documentation { */ class DocumentationEngine { public: - /** - * This exception is thrown by the addDocumentation method if a provided Documentation - * has an identifier, but the identifier was registered previously. - */ - struct DuplicateDocumentationException : public ghoul::RuntimeError { - /** - * Constructor of a DuplicateDocumentationException storing the offending - * Documentation for later use. - * - * \param doc The Documentation whose identifier was previously registered - */ - explicit DuplicateDocumentationException(Documentation doc); - - /// The offending Documentation whose identifier was previously registered - Documentation documentation; - }; - DocumentationEngine(); /** diff --git a/include/openspace/mission/missionmanager.h b/include/openspace/mission/missionmanager.h index b07dcd5973..50bd573e47 100644 --- a/include/openspace/mission/missionmanager.h +++ b/include/openspace/mission/missionmanager.h @@ -41,10 +41,6 @@ namespace scripting { struct LuaLibrary; } */ class MissionManager { public: - struct MissionManagerException : public ghoul::RuntimeError { - explicit MissionManagerException(std::string error); - }; - MissionManager(); /** diff --git a/modules/base/dashboard/dashboarditemtimevaryingtext.cpp b/modules/base/dashboard/dashboarditemtimevaryingtext.cpp index c82c5016e7..ff63602fe7 100644 --- a/modules/base/dashboard/dashboarditemtimevaryingtext.cpp +++ b/modules/base/dashboard/dashboarditemtimevaryingtext.cpp @@ -185,8 +185,7 @@ void DashboardItemTimeVaryingText::loadDataFromJson(const std::string& filePath) std::ifstream file = std::ifstream(filePath); if (!file.is_open()) { throw ghoul::RuntimeError(std::format( - "Time varying text, '{}' is not a valid JSON file", - filePath + "Time varying text, '{}' is not a valid JSON file", filePath )); } diff --git a/modules/base/rendering/pointcloud/renderablepointcloud.cpp b/modules/base/rendering/pointcloud/renderablepointcloud.cpp index e53281bd51..52763d56b4 100644 --- a/modules/base/rendering/pointcloud/renderablepointcloud.cpp +++ b/modules/base/rendering/pointcloud/renderablepointcloud.cpp @@ -954,9 +954,7 @@ void RenderablePointCloud::initializeSingleTexture() { std::filesystem::path p = absPath(_texture.spriteTexturePath); if (!std::filesystem::is_regular_file(p)) { - throw ghoul::RuntimeError(std::format( - "Could not find image file '{}'", p - )); + throw ghoul::RuntimeError(std::format("Could not find image file '{}'", p)); } loadTexture(p, 0); @@ -1018,9 +1016,7 @@ void RenderablePointCloud::loadTexture(const std::filesystem::path& path, int in convertTextureFormat(*t, targetFormat); } else { - throw ghoul::RuntimeError(std::format( - "Could not find image file {}", path - )); + throw ghoul::RuntimeError(std::format("Could not find image file {}", path)); } TextureFormat format = { diff --git a/modules/base/rendering/renderableswitch.cpp b/modules/base/rendering/renderableswitch.cpp index 1d4dbc0e9c..c124285026 100644 --- a/modules/base/rendering/renderableswitch.cpp +++ b/modules/base/rendering/renderableswitch.cpp @@ -88,7 +88,7 @@ RenderableSwitch::RenderableSwitch(const ghoul::Dictionary& dictionary) if (!p.renderableNear.has_value() && !p.renderableFar.has_value()) { throw ghoul::RuntimeError( "Either a RenderableNear or a RenderableFar (or both) has to be provided, " - "but omitting both is invalid." + "but omitting both is invalid" ); } diff --git a/modules/fieldlinessequence/tasks/kameleonvolumetofieldlinestask.cpp b/modules/fieldlinessequence/tasks/kameleonvolumetofieldlinestask.cpp index 85434b1d7d..e40a6aa34b 100644 --- a/modules/fieldlinessequence/tasks/kameleonvolumetofieldlinestask.cpp +++ b/modules/fieldlinessequence/tasks/kameleonvolumetofieldlinestask.cpp @@ -154,7 +154,7 @@ void KameleonVolumeToFieldlinesTask::perform( std::unordered_map> seedPoints = fls::extractSeedPointsFromFiles(_seedpointsPath, _nthSeedPoint); if (seedPoints.empty()) { - throw ghoul::RuntimeError("Falied to read seedpoints"); + throw ghoul::RuntimeError("Failed to read seed points"); } size_t fileNumber = 0; diff --git a/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp b/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp index a889499686..45247dd6f9 100644 --- a/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp +++ b/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp @@ -353,8 +353,7 @@ RenderableTimeVaryingFitsSphere::RenderableTimeVaryingFitsSphere( else { throw ghoul::RuntimeError(std::format( "The two values at {} needs to be of type double, a number with " - "at least one decimal", - intKey + "at least one decimal", intKey )); } } @@ -475,8 +474,7 @@ void RenderableTimeVaryingFitsSphere::extractMandatoryInfoFromSourceFolder() { if (!std::filesystem::is_directory(sourceFolder)) { throw ghoul::RuntimeError(std::format( "Source folder '{}' for RenderableTimeVaryingFitsSphere is not a valid " - "directory", - sourceFolder + "directory", sourceFolder )); } // Extract all file paths from the provided folder diff --git a/modules/gaia/tasks/readfilejob.cpp b/modules/gaia/tasks/readfilejob.cpp index 6d645944f4..7596b43703 100644 --- a/modules/gaia/tasks/readfilejob.cpp +++ b/modules/gaia/tasks/readfilejob.cpp @@ -59,8 +59,8 @@ void ReadFileJob::execute() { ); if (!table) { - throw ghoul::RuntimeError( - std::format("Failed to open Fits file '{}'", _inFilePath + throw ghoul::RuntimeError(std::format( + "Failed to open Fits file '{}'", _inFilePath )); } diff --git a/modules/globebrowsing/src/tileprovider/singleimagetileprovider.cpp b/modules/globebrowsing/src/tileprovider/singleimagetileprovider.cpp index 721c50dd0a..eeb41cedff 100644 --- a/modules/globebrowsing/src/tileprovider/singleimagetileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/singleimagetileprovider.cpp @@ -83,9 +83,9 @@ void SingleImageProvider::reset() { _tileTexture = ghoul::io::TextureReader::ref().loadTexture(_filePath.value(), 2); if (!_tileTexture) { - throw ghoul::RuntimeError( - std::format("Unable to load texture '{}'", _filePath.value()) - ); + throw ghoul::RuntimeError(std::format( + "Unable to load texture '{}'", _filePath.value() + )); } _tileTexture->uploadTexture(); diff --git a/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp index 7b215aa8ae..359b43399c 100644 --- a/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp @@ -297,8 +297,7 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary) if (_folder.files.empty()) { throw ghoul::RuntimeError(std::format( "Error loading layer '{}'. Folder '{}' does not contain any files that " - "matched the time format", - _identifier, _folder.folder + "matched the time format", _identifier, _folder.folder )); } } diff --git a/modules/globebrowsing/src/timequantizer.cpp b/modules/globebrowsing/src/timequantizer.cpp index 9222efdcc6..40a2a0f1bf 100644 --- a/modules/globebrowsing/src/timequantizer.cpp +++ b/modules/globebrowsing/src/timequantizer.cpp @@ -276,10 +276,10 @@ void DateTime::decrementOnce(int value, char unit) { break; default: - throw ghoul::RuntimeError( - "Invalid unit format in TQ decrementOnce '" + std::to_string(unit) + - "'. Expected 'y', 'M', 'd', 'h', or 'm'" - ); + throw ghoul::RuntimeError(std::format( + "Invalid unit format in TQ decrementOnce '{}'. Expected 'y', 'M', 'd', " + "'h', or 'm'", unit + )); } } @@ -349,7 +349,9 @@ double TimeQuantizer::parseTimeResolutionStr(const std::string& resolutionStr) { _resolutionValue = value; _resolutionUnit = unit; if (*p) { // not a number - throw ghoul::RuntimeError("Cannot convert " + numberString + " to number"); + throw ghoul::RuntimeError(std::format( + "Cannot convert {} to number", numberString + )); } else { verifyResolutionRestrictions(static_cast(value), unit); diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index 5e8cce83dc..cc0cd75a74 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -73,10 +73,9 @@ std::array gridVariables(ccmc::Model* model) { // validate if (tokens.size() != 3) { - throw ghoul::RuntimeError( - "Expected three dimensional grid system. Got " + - std::to_string(tokens.size()) + "dimensions" - ); + throw ghoul::RuntimeError(std::format( + "Expected three dimensional grid system. Got {} dimensions", tokens.size() + )); } std::string x = std::move(tokens.at(0)); diff --git a/modules/space/kepler.cpp b/modules/space/kepler.cpp index 0d8c821d97..b7818ec76c 100644 --- a/modules/space/kepler.cpp +++ b/modules/space/kepler.cpp @@ -210,9 +210,9 @@ namespace { e += ".0"; } if (e.size() <= 2) { - throw ghoul::RuntimeError( - std::format("Error parsing epoch '{}'. Invalid date string", epoch) - ); + throw ghoul::RuntimeError(std::format( + "Error parsing epoch '{}'. Invalid date string", epoch + )); } std::string_view yearStr = std::string_view(e).substr(0, 2); diff --git a/modules/space/rendering/renderabletravelspeed.cpp b/modules/space/rendering/renderabletravelspeed.cpp index eef73a859c..87223e8bb7 100644 --- a/modules/space/rendering/renderabletravelspeed.cpp +++ b/modules/space/rendering/renderabletravelspeed.cpp @@ -176,7 +176,7 @@ RenderableTravelSpeed::RenderableTravelSpeed(const ghoul::Dictionary& dictionary void RenderableTravelSpeed::initialize() { _targetNode = sceneGraphNode(_targetName); - if (_targetNode == nullptr) { + if (!_targetNode) { throw ghoul::RuntimeError("Could not find Target Node"); } } diff --git a/modules/space/translation/keplertranslation.cpp b/modules/space/translation/keplertranslation.cpp index adaca9248e..5b0d6984b9 100644 --- a/modules/space/translation/keplertranslation.cpp +++ b/modules/space/translation/keplertranslation.cpp @@ -31,6 +31,15 @@ #include namespace { + struct RangeError : public ghoul::RuntimeError { + explicit RangeError(std::string off) : + ghoul::RuntimeError( + std::format("Value '{}' out of range", off), + "KeplerTranslation" + ) + {} + }; + template T solveIteration(const Func& function, T x0, const T& err = 0.0, int maxIter = 100) { T x2 = x0; @@ -145,11 +154,6 @@ namespace { namespace openspace { -KeplerTranslation::RangeError::RangeError(std::string off) - : ghoul::RuntimeError("Value '" + off + "' out of range", "KeplerTranslation") - , offender(std::move(off)) -{} - documentation::Documentation KeplerTranslation::Documentation() { return codegen::doc("space_transform_kepler"); } diff --git a/modules/space/translation/keplertranslation.h b/modules/space/translation/keplertranslation.h index 9533e3ed59..213d99e288 100644 --- a/modules/space/translation/keplertranslation.h +++ b/modules/space/translation/keplertranslation.h @@ -43,12 +43,6 @@ namespace openspace { */ class KeplerTranslation : public Translation { public: - struct RangeError : public ghoul::RuntimeError { - explicit RangeError(std::string off); - - std::string offender; - }; - /** * The constructor that retrieves the required Keplerian elements from the passed * \p dictionary. These values are then apssed to the setKeplerElements method for diff --git a/modules/sync/syncs/urlsynchronization.cpp b/modules/sync/syncs/urlsynchronization.cpp index 096c0aa2b7..885f9b29d6 100644 --- a/modules/sync/syncs/urlsynchronization.cpp +++ b/modules/sync/syncs/urlsynchronization.cpp @@ -104,8 +104,7 @@ UrlSynchronization::UrlSynchronization(const ghoul::Dictionary& dictionary, if (p.filename.has_value() && _urls.size() > 1) { throw ghoul::RuntimeError(std::format( "UrlSynchronization ({}) requested overwrite filename but specified {} URLs " - "to download, which is not legal", - p.identifier, _urls.size() + "to download, which is not legal", p.identifier, _urls.size() )); } _filename = p.filename.value_or(_filename); diff --git a/modules/volume/volumegridtype.cpp b/modules/volume/volumegridtype.cpp index 3421cda0fe..557c422c89 100644 --- a/modules/volume/volumegridtype.cpp +++ b/modules/volume/volumegridtype.cpp @@ -26,11 +26,6 @@ namespace openspace::volume { -InvalidGridTypeError::InvalidGridTypeError(std::string gridType_) - : RuntimeError(std::format("Invalid grid type: '{}'", gridType_)) - , gridType(std::move(gridType_)) -{} - VolumeGridType parseGridType(const std::string& gridType) { if (gridType == "Cartesian") { return VolumeGridType::Cartesian; @@ -38,7 +33,7 @@ VolumeGridType parseGridType(const std::string& gridType) { if (gridType == "Spherical") { return VolumeGridType::Spherical; } - throw InvalidGridTypeError(gridType); + throw ghoul::RuntimeError(std::format("Invalid grid type: '{}'", gridType)); } std::string gridTypeToString(VolumeGridType gridType) { diff --git a/modules/volume/volumegridtype.h b/modules/volume/volumegridtype.h index 0d8a07edd9..a91f811ab7 100644 --- a/modules/volume/volumegridtype.h +++ b/modules/volume/volumegridtype.h @@ -35,12 +35,6 @@ enum class VolumeGridType : int { Spherical = 1 }; -struct InvalidGridTypeError : public ghoul::RuntimeError { - explicit InvalidGridTypeError(std::string gridType_); - - std::string gridType; -}; - VolumeGridType parseGridType(const std::string& gridType); std::string gridTypeToString(VolumeGridType); diff --git a/src/data/csvloader.cpp b/src/data/csvloader.cpp index a8eb92a61d..3ca1593383 100644 --- a/src/data/csvloader.cpp +++ b/src/data/csvloader.cpp @@ -281,8 +281,7 @@ std::vector loadTextureMapFile(std::filesystem::path path, throw ghoul::RuntimeError(std::format( "Error loading texture map file {}: Line {} has too many parameters. " "Expected 2: an integer index followed by a filename, where the file " - "name may not include whitespaces", - path, currentLineNumber + "name may not include whitespaces", path, currentLineNumber )); } diff --git a/src/data/speckloader.cpp b/src/data/speckloader.cpp index 0ef5b62521..c192ab8e15 100644 --- a/src/data/speckloader.cpp +++ b/src/data/speckloader.cpp @@ -186,8 +186,7 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional spe if (nNonEmptyTokens > 4) { throw ghoul::RuntimeError(std::format( "Error loading speck file {}: Too many arguments for texture on line " - "{}", - path, currentLineNumber + "{}", path, currentLineNumber )); } @@ -228,8 +227,7 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional spe throw ghoul::RuntimeError(std::format( "Error in line {} while reading the header information of file '{}'. Line is " "neither a comment line, nor starts with one of the supported keywords for " - "SPECK files", - currentLineNumber, path + "SPECK files", currentLineNumber, path )); } @@ -300,8 +298,7 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional spe // line count in the beginning of the while loop we are currently in throw ghoul::RuntimeError(std::format( "Error loading position information out of data line {} in file '{}'. " - "Value was not a number", - currentLineNumber - 1, path + "Value was not a number", currentLineNumber - 1, path )); } @@ -334,8 +331,7 @@ Dataset loadSpeckFile(std::filesystem::path path, std::optional spe // currently in throw ghoul::RuntimeError(std::format( "Error loading data value {} out of data line {} in file '{}'. " - "Value was not a number", - i, currentLineNumber - 1, path + "Value was not a number", i, currentLineNumber - 1, path )); } } diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index f20e79e255..6b44f0b25b 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -276,14 +276,6 @@ namespace openspace::documentation { DocumentationEngine* DocumentationEngine::_instance = nullptr; -DocumentationEngine::DuplicateDocumentationException::DuplicateDocumentationException( - Documentation doc) - : ghoul::RuntimeError(std::format( - "Duplicate Documentation with name '{}' and id '{}'", doc.name, doc.id - )) - , documentation(std::move(doc)) -{} - DocumentationEngine::DocumentationEngine() {} void DocumentationEngine::initialize() { @@ -731,7 +723,10 @@ void DocumentationEngine::addDocumentation(Documentation documentation) { ); if (it != _documentations.end()) { - throw DuplicateDocumentationException(std::move(documentation)); + throw ghoul::RuntimeError(std::format( + "Duplicate Documentation with name '{}' and id '{}'", + documentation.name, documentation.id + )); } else { _documentations.push_back(std::move(documentation)); diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 74d4466bb1..4863cce992 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1808,7 +1808,7 @@ void setCameraFromProfile(const Profile& p) { } auto checkNodeExists = [](const std::string& node) { - if (global::renderEngine->scene()->sceneGraphNode(node) == nullptr) { + if (!global::renderEngine->scene()->sceneGraphNode(node)) { throw ghoul::RuntimeError(std::format( "Error when setting camera from profile. Could not find node '{}'", node )); diff --git a/src/interaction/actionmanager_lua.inl b/src/interaction/actionmanager_lua.inl index 7f3d124361..4d752fe875 100644 --- a/src/interaction/actionmanager_lua.inl +++ b/src/interaction/actionmanager_lua.inl @@ -130,11 +130,11 @@ struct [[codegen::Dictionary(Action)]] Action { a.textColor = action.textColor; a.guiPath = action.guiPath.value_or(a.guiPath); if (!a.guiPath.starts_with('/')) { - throw ghoul::RuntimeError( - std::format( - "Tried to register action: '{}'. The field 'GuiPath' is set to '{}' but " - "should be '/{}' ", a.name, a.guiPath, a.guiPath) - ); + throw ghoul::RuntimeError(std::format( + "Tried to register action: '{}'. The field 'GuiPath' is set to '{}' but " + "should be '/{}'", + a.name, a.guiPath, a.guiPath + )); } if (action.isLocal.has_value()) { a.isLocal = interaction::Action::IsLocal(*action.isLocal); diff --git a/src/interaction/sessionrecordinghandler.cpp b/src/interaction/sessionrecordinghandler.cpp index a5540d18b0..0719a2e9ae 100644 --- a/src/interaction/sessionrecordinghandler.cpp +++ b/src/interaction/sessionrecordinghandler.cpp @@ -54,6 +54,12 @@ namespace { template struct overloaded : Ts... { using Ts::operator()...; }; template overloaded(Ts...) -> overloaded; + struct SessionRecordingError : public ghoul::RuntimeError { + explicit SessionRecordingError(std::string message) + : ghoul::RuntimeError(std::move(message), "SessionRecording") + {} + }; + constexpr openspace::properties::Property::PropertyInfo RenderPlaybackInfo = { "RenderInfo", "Render Playback Information", @@ -165,7 +171,7 @@ void SessionRecordingHandler::tickPlayback(double dt) { if (!hasValidPrevCamera && !hasValidNextCamera) { - throw ghoul::RuntimeError("No valid camera keyframes found in recording"); + throw SessionRecordingError("No valid camera keyframes found in recording"); } // update camera with or without new keyframes @@ -292,15 +298,13 @@ void SessionRecordingHandler::render() const { void SessionRecordingHandler::startRecording() { if (_state == SessionState::Recording) { - throw ghoul::RuntimeError( - "Unable to start recording while already in recording mode", - "SessionRecordingHandler" + throw SessionRecordingError( + "Unable to start recording while already in recording mode" ); } else if (isPlayingBack()) { - throw ghoul::RuntimeError( - "Unable to start recording while in session playback mode", - "SessionRecordingHandler" + throw SessionRecordingError( + "Unable to start recording while in session playback mode" ); } @@ -329,9 +333,9 @@ void SessionRecordingHandler::stopRecording(const std::filesystem::path& filenam } if (!overwrite && std::filesystem::is_regular_file(filename)) { - throw ghoul::RuntimeError(std::format( + throw SessionRecordingError(std::format( "Unable to start recording. File '{}' already exists", filename - ), "SessionRecording"); + )); } for (const auto& [prop, script] : _savePropertiesBaseline) { @@ -358,13 +362,13 @@ void SessionRecordingHandler::startPlayback(SessionRecording timeline, bool loop if (_state == SessionState::Recording) { global::openSpaceEngine->setMode(prevMode); - throw ghoul::RuntimeError( + throw SessionRecordingError( "Unable to start playback while in session recording mode" ); } else if (isPlayingBack()) { global::openSpaceEngine->setMode(prevMode); - throw ghoul::RuntimeError( + throw SessionRecordingError( "Unable to start new playback while in session playback mode" ); } @@ -381,11 +385,11 @@ void SessionRecordingHandler::startPlayback(SessionRecording timeline, bool loop if (timeline.entries.empty()) { global::openSpaceEngine->setMode(prevMode); - throw ghoul::RuntimeError("Session recording is empty"); + throw SessionRecordingError("Session recording is empty"); } if (!timeline.hasCameraFrame()) { global::openSpaceEngine->setMode(prevMode); - throw ghoul::RuntimeError("Session recording did not contain camera keyframes"); + throw SessionRecordingError("Session recording did not contain camera keyframes"); } _timeline = std::move(timeline); @@ -432,7 +436,7 @@ void SessionRecordingHandler::setupPlayback(double startTime) { std::get(firstCamera->value).focusNode; auto it = std::find(_loadedNodes.begin(), _loadedNodes.end(), startFocusNode); if (it == _loadedNodes.end()) { - throw ghoul::RuntimeError(std::format( + throw SessionRecordingError(std::format( "Playback file requires scenegraph node '{}', which is " "not currently loaded", startFocusNode )); diff --git a/src/mission/missionmanager.cpp b/src/mission/missionmanager.cpp index ef627e4319..34b06b1d18 100644 --- a/src/mission/missionmanager.cpp +++ b/src/mission/missionmanager.cpp @@ -34,11 +34,15 @@ #include "missionmanager_lua.inl" -namespace openspace { +namespace { + struct MissionManagerException : public ghoul::RuntimeError { + explicit MissionManagerException(std::string message) + : ghoul::RuntimeError(std::move(message), "MissionManager") + {} + }; +} // namespace -MissionManager::MissionManagerException::MissionManagerException(std::string error) - : ghoul::RuntimeError(std::move(error), "MissionManager") -{} +namespace openspace { MissionManager::MissionManager() : _currentMission(_missionMap.end()) {} diff --git a/src/rendering/framebufferrenderer.cpp b/src/rendering/framebufferrenderer.cpp index 82a82f0af4..d5e59d6f51 100644 --- a/src/rendering/framebufferrenderer.cpp +++ b/src/rendering/framebufferrenderer.cpp @@ -943,7 +943,8 @@ void FramebufferRenderer::updateRaycastData() { absPath(ExitFragmentShaderPath), dict ); - } catch (const ghoul::RuntimeError& e) { + } + catch (const ghoul::RuntimeError& e) { LERROR(e.message); } @@ -956,7 +957,8 @@ void FramebufferRenderer::updateRaycastData() { absPath(RaycastFragmentShaderPath), outsideDict ); - } catch (const ghoul::RuntimeError& e) { + } + catch (const ghoul::RuntimeError& e) { LERROR(e.message); } diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index 9860688f89..723ba68f45 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -940,8 +940,7 @@ Asset* AssetManager::retrieveAsset(const std::filesystem::path& path, } else { throw ghoul::RuntimeError(std::format( - "Could not find asset file '{}' requested by '{}'", - path, retriever + "Could not find asset file '{}' requested by '{}'", path, retriever )); } } diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index e194d19d3b..8e3f2fed91 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -88,16 +88,14 @@ bool ownerMatchesGroupTag(const openspace::properties::PropertyOwner* owner, throw ghoul::RuntimeError(std::format( "Only a single instruction to combine tags is supported. Found an " "intersection ('{}') and a negation instruction ('{}') in the query: " - "'{}'", - Intersection, Negation, tagToMatch + "'{}'", Intersection, Negation, tagToMatch )); } if (tagToMatch.find(Union) != std::string_view::npos) { throw ghoul::RuntimeError(std::format( "Only a single instruction to combine tags is supported. Found an " "intersection ('{}') and a union instruction ('{}') in the query: " - "'{}'", - Intersection, Union, tagToMatch + "'{}'", Intersection, Union, tagToMatch )); } @@ -115,16 +113,14 @@ bool ownerMatchesGroupTag(const openspace::properties::PropertyOwner* owner, throw ghoul::RuntimeError(std::format( "Only a single instruction to combine tags is supported. Found a " "negation ('{}') and an intersection instruction ('{}') in the query: " - "'{}'", - Negation, Intersection, tagToMatch + "'{}'", Negation, Intersection, tagToMatch )); } if (tagToMatch.find(Union) != std::string_view::npos) { throw ghoul::RuntimeError(std::format( "Only a single instruction to combine tags is supported. Found a " "negation ('{}') and a union instruction ('{}') in the query: " - "'{}'", - Negation, Union, tagToMatch + "'{}'", Negation, Union, tagToMatch )); } @@ -142,16 +138,14 @@ bool ownerMatchesGroupTag(const openspace::properties::PropertyOwner* owner, throw ghoul::RuntimeError(std::format( "Only a single instruction to combine tags is supported. Found a union " "('{}') and a negation instruction ('{}') in the query: " - "'{}'", - Union, Negation, tagToMatch + "'{}'", Union, Negation, tagToMatch )); } if (tagToMatch.find(Intersection) != std::string_view::npos) { throw ghoul::RuntimeError(std::format( "Only a single instruction to combine tags is supported. Found a union " "('{}') and an intersection instruction ('{}') in the query: " - "'{}'", - Union, Intersection, tagToMatch + "'{}'", Union, Intersection, tagToMatch )); }