mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Expose loot-condition-interpreter error codes to callers
Make ConditionSyntaxError extend from system_error instead of directly from runtime_error, so that callers can use the exception's code to distinguish between different causes.
This commit is contained in:
@@ -32,9 +32,9 @@ namespace loot {
|
||||
* @brief An exception class thrown if invalid syntax is encountered when
|
||||
* parsing a metadata condition.
|
||||
*/
|
||||
class ConditionSyntaxError : public std::runtime_error {
|
||||
class ConditionSyntaxError : public std::system_error {
|
||||
public:
|
||||
using std::runtime_error::runtime_error;
|
||||
using std::system_error::system_error;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,14 @@ LOOT_API const std::error_category& esplugin_category();
|
||||
* derived from std::error_category.
|
||||
*/
|
||||
LOOT_API const std::error_category& libloadorder_category();
|
||||
|
||||
/**
|
||||
* @brief Get the error category that can be used to identify system_error
|
||||
* exceptions that are due to loot condition interpreter errors.
|
||||
* @returns A reference to the static object of unspecified runtime type,
|
||||
* derived from std::error_category.
|
||||
*/
|
||||
LOOT_API const std::error_category& loot_condition_interpreter_category();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user