Remove ConditionSyntaxError

It's not usefully different from throwing std::runtime_error.
This commit is contained in:
Oliver Hamlet
2025-06-08 17:58:27 +01:00
parent fe3e2b2711
commit 2b0eec9929
15 changed files with 5 additions and 159 deletions
@@ -47,20 +47,6 @@ class libloadorder_category : public std::error_category {
return code.category().name() == name();
}
};
class loot_condition_interpreter_category : public std::error_category {
const char* name() const noexcept override {
return "loot condition interpreter";
}
std::string message(int) const override {
return "loot condition interpreter error";
}
bool equivalent(const std::error_code& code, int) const noexcept override {
return code.category().name() == name();
}
};
}
LOOT_API const std::error_category& esplugin_category() {
@@ -72,9 +58,4 @@ LOOT_API const std::error_category& libloadorder_category() {
static detail::libloadorder_category instance;
return instance;
}
LOOT_API const std::error_category& loot_condition_interpreter_category() {
static detail::loot_condition_interpreter_category instance;
return instance;
}
}
-8
View File
@@ -2,7 +2,6 @@
#include <charconv>
#include "loot/exception/condition_syntax_error.h"
#include "loot/exception/cyclic_interaction_error.h"
#include "loot/exception/error_categories.h"
#include "loot/exception/undefined_group_error.h"
@@ -18,7 +17,6 @@ constexpr std::string_view UNDEFINED_GROUP_ERROR_PREFIX =
"UndefinedGroupError: "sv;
constexpr std::string_view ESPLUGIN_ERROR_PREFIX = "EspluginError: "sv;
constexpr std::string_view LIBLOADORDER_ERROR_PREFIX = "LibloadorderError: "sv;
constexpr std::string_view LCI_ERROR_PREFIX = "LciError: "sv;
constexpr std::string_view INVALID_ARGUMENT_PREFIX = "InvalidArgument: "sv;
bool startsWith(std::string_view str, std::string_view prefix) {
@@ -153,12 +151,6 @@ std::exception_ptr mapError(const ::rust::Error& error) {
return std::make_exception_ptr(
std::system_error(code, libloadorder_category(), details));
} else if (startsWith(error.what(), LCI_ERROR_PREFIX)) {
const auto [code, details] = parseSystemError(
std::string_view(error.what()).substr(LCI_ERROR_PREFIX.size()));
return std::make_exception_ptr(ConditionSyntaxError(
code, loot_condition_interpreter_category(), details));
} else if (startsWith(error.what(), INVALID_ARGUMENT_PREFIX)) {
return std::make_exception_ptr(
std::invalid_argument(getErrorSuffix(error.what())));