* @param message message of exception
*/
PluginLoadException::PluginLoadException(const char *plugin, const char *message)
- : Exception()
+ : Exception(), __plugin_name(plugin)
{
append("Plugin '%s' could not be loaded: %s", plugin, message);
}
+/** Destructor. */
+PluginLoadException::~PluginLoadException() throw()
+{
+}
+
/** Constructor.
* @param plugin name of the plugin that caused the exception
* @param message message of exception
*/
PluginLoadException::PluginLoadException(const char *plugin, const char *message,
Exception &e)
- : Exception()
+ : Exception(), __plugin_name(plugin)
{
append("Plugin '%s' could not be loaded: %s", plugin, message);
copy_messages(e);
}
+/** Get name of plugin which failed to load.
+ * @return plugin name
+ */
+std::string
+PluginLoadException::plugin_name() const
+{
+ return __plugin_name;
+}
+
/** @class PluginUnloadException <plugin/loader.h>
* This exception is thrown if the requested plugin could not be unloaded.
public:
PluginLoadException(const char *plugin, const char *message);
PluginLoadException(const char *plugin, const char *message, Exception &e);
+ ~PluginLoadException() throw();
+
+ std::string plugin_name() const;
+
+ private:
+ std::string __plugin_name;
};
class PluginUnloadException : public Exception
#include <blackboard/local.h>
#include <aspect/inifin.h>
#include <plugin/manager.h>
+#include <plugin/loader.h>
#include <plugin/net/handler.h>
#include <cstdio>
} else {
try {
__plugin_manager->load("default");
+ } catch (PluginLoadException &e) {
+ if (e.plugin_name() != "default") {
+ // only print if name is not default, i.e. one of the plugins that
+ // the default meta plugin
+ __multi_logger->log_error("FawkesMainThread", "Failed to load default "
+ "plugins, exception follows");
+ __multi_logger->log_error("FawkesMainThread", e);
+ }
} catch (Exception &e) {
- // ignored, there is no default meta plugin set
- __multi_logger->log_error("FawkesMainThread", "Failed to load default plugins, exception follows");
- __multi_logger->log_error("FawkesMainThread", e);
+ __multi_logger->log_error("FawkesMainThread", "Failed to load default "
+ "plugins, exception follows");
+ __multi_logger->log_error("FawkesMainThread", e);
}
}
}