Custom plugin base exception

Useful to differentiate between plugin and non-plugin exceptions.
This commit is contained in:
TheAssassin
2018-06-19 20:45:16 +02:00
parent 1736e05958
commit e977d16dc9
2 changed files with 11 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ namespace linuxdeploy {
public:
explicit PrivateData(const boost::filesystem::path& path) : pluginPath(path) {
if (!boost::filesystem::exists(path)) {
throw std::runtime_error("No such file or directory: " + path.string());
throw PluginError("No such file or directory: " + path.string());
}
apiLevel = getApiLevelFromExecutable();

View File

@@ -19,9 +19,17 @@ namespace linuxdeploy {
/*
* Exception class indicating that the plugin doesn't implement the right API level for the selected class
*/
class WrongApiLevelError : public std::runtime_error {
class PluginError : public std::runtime_error {
public:
explicit WrongApiLevelError(const std::string& msg) : std::runtime_error(msg) {}
explicit PluginError(const std::string& msg) : std::runtime_error(msg) {}
};
/*
* Exception class indicating that the plugin doesn't implement the right API level for the selected class
*/
class WrongApiLevelError : public PluginError {
public:
explicit WrongApiLevelError(const std::string& msg) : PluginError(msg) {}
};
enum PLUGIN_TYPE {