Have the documentation print out more information if an error occurs

Add other scene files (commented out) to the openspace.cfg
This commit is contained in:
Alexander Bock
2017-12-25 09:10:22 +01:00
parent d749c43a54
commit 1079d67c9a
4 changed files with 48 additions and 4 deletions
+30
View File
@@ -68,6 +68,32 @@ std::string to_string(std::string value) {
return value;
}
std::string to_string(openspace::documentation::TestResult testResult) {
using namespace openspace::documentation;
if (testResult.success) {
return "Success";
}
else {
std::stringstream stream;
stream << "Failure." << '\n';
for (const TestResult::Offense& offense : testResult.offenses) {
stream << " " << std::to_string(offense) << '\n';
}
for (const TestResult::Warning& warning : testResult.warnings) {
stream << " " << std::to_string(warning) << '\n';
}
return stream.str();
}
}
std::string to_string(openspace::documentation::TestResult::Offense offense) {
return offense.offender + ": " + std::to_string(offense.reason);
}
std::string to_string(openspace::documentation::TestResult::Offense::Reason reason) {
switch (reason) {
case openspace::documentation::TestResult::Offense::Reason::ExtraKey:
@@ -85,6 +111,10 @@ std::string to_string(openspace::documentation::TestResult::Offense::Reason reas
}
}
std::string to_string(openspace::documentation::TestResult::Warning warning) {
return warning.offender + ": " + std::to_string(warning.reason);
}
std::string to_string(openspace::documentation::TestResult::Warning::Reason reason) {
switch (reason) {
case openspace::documentation::TestResult::Warning::Reason::Deprecated:
+10
View File
@@ -22,6 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <openspace/documentation/documentation.h>
#include <regex>
namespace openspace {
@@ -364,6 +366,14 @@ int addSceneGraphNode(lua_State* L) {
}
OsEng.renderEngine().scene()->initializeNode(node);
}
catch (const documentation::SpecificationError& e) {
return luaL_error(
L,
"Error loading scene graph node: %s: %s",
e.what(),
std::to_string(e.result).c_str()
);
} catch (const ghoul::RuntimeError& e) {
return luaL_error(L, "Error loading scene graph node: %s", e.what());
}