mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Rework handling of esplugin errors
The error scenario represented by PluginNotLoadedError is distinguished from all other esplugin errors by LOOT, so it's worth handling separately.
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
#include "loot/enum/game_type.h"
|
||||
#include "loot/enum/log_level.h"
|
||||
#include "loot/exception/cyclic_interaction_error.h"
|
||||
#include "loot/exception/error_categories.h"
|
||||
#include "loot/exception/plugin_not_loaded_error.h"
|
||||
#include "loot/exception/undefined_group_error.h"
|
||||
#include "loot/game_interface.h"
|
||||
#include "loot/loot_version.h"
|
||||
|
||||
+9
-10
@@ -22,21 +22,20 @@
|
||||
<https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LOOT_ERROR_CATEGORIES
|
||||
#define LOOT_ERROR_CATEGORIES
|
||||
#ifndef LOOT_EXCEPTION_PLUGIN_NOT_LOADED_ERROR
|
||||
#define LOOT_EXCEPTION_PLUGIN_NOT_LOADED_ERROR
|
||||
|
||||
#include <system_error>
|
||||
|
||||
#include "loot/api_decorator.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace loot {
|
||||
/**
|
||||
* @brief Get the error category that can be used to identify system_error
|
||||
* exceptions that are due to esplugin errors.
|
||||
* @returns A reference to the static object of unspecified runtime type,
|
||||
* derived from std::error_category.
|
||||
* @brief An exception class thrown if a plugin that must be loaded hasn't been
|
||||
* loaded.
|
||||
*/
|
||||
LOOT_API const std::error_category& esplugin_category();
|
||||
class PluginNotLoadedError : public std::runtime_error {
|
||||
public:
|
||||
using std::runtime_error::runtime_error;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user