mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 02:49:03 -06:00
Provide error message when loading a speckfile that does not contain only numbers (closes #1903)
This commit is contained in:
@@ -315,10 +315,27 @@ Dataset loadFile(std::filesystem::path path, SkipAllZeroLines skipAllZeroLines)
|
||||
str >> entry.position.x >> entry.position.y >> entry.position.z;
|
||||
allZero &= (entry.position == glm::vec3(0.0));
|
||||
|
||||
if (!str.good()) {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"Error loading position information out of data line {} in file {}. "
|
||||
"Value was not a number",
|
||||
res.entries.size(), path
|
||||
));
|
||||
}
|
||||
|
||||
entry.data.resize(nDataValues);
|
||||
for (int i = 0; i < nDataValues; i += 1) {
|
||||
str >> entry.data[i];
|
||||
bool isGood = str.good();
|
||||
allZero &= (entry.data[i] == 0.0);
|
||||
|
||||
if (!str.good()) {
|
||||
throw ghoul::RuntimeError(fmt::format(
|
||||
"Error loading data value {} out of data line {} in file {}. "
|
||||
"Value was not a number",
|
||||
i, res.entries.size(), path
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (skipAllZeroLines && allZero) {
|
||||
|
||||
@@ -65,7 +65,12 @@ void MultiThreadedSceneInitializer::initializeNode(SceneGraphNode* node) {
|
||||
);
|
||||
}
|
||||
|
||||
node->initialize();
|
||||
try {
|
||||
node->initialize();
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
LERRORC(e.component, e.message);
|
||||
}
|
||||
std::lock_guard g(_mutex);
|
||||
_initializedNodes.push_back(node);
|
||||
_initializingNodes.erase(node);
|
||||
|
||||
Reference in New Issue
Block a user