Give a better error message when an action GuiPath doesn't start with a '/'

This commit is contained in:
Ylva Selling
2023-04-21 12:40:19 -04:00
parent fdc238c3bc
commit fe9058c523
+5 -1
View File
@@ -117,7 +117,11 @@ struct [[codegen::Dictionary(Action)]] Action {
a.documentation = action.documentation.value_or(a.documentation);
a.guiPath = action.guiPath.value_or(a.guiPath);
if (!a.guiPath.starts_with('/')) {
throw ghoul::RuntimeError("Action's GuiPath must start with /");
throw ghoul::RuntimeError(
fmt::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);