diff --git a/lib/utils/mu-error.hh b/lib/utils/mu-error.hh index 2b5ae9a1..92ddd5ef 100644 --- a/lib/utils/mu-error.hh +++ b/lib/utils/mu-error.hh @@ -22,6 +22,7 @@ #include #include "mu-utils.hh" +#include "mu-util.h" #include namespace Mu { @@ -69,7 +70,7 @@ struct Error final : public std::exception { } Error(Error&& rhs) = default; - Error(const Error& rhs) = delete; + Error(const Error& rhs) = default; /** * Build an error from a GError an error-code and a format string @@ -118,7 +119,18 @@ struct Error final : public std::exception { */ Code code() const { return code_; } - private: + + /** + * Fill a GError with the error information + * + * @param err GError** (or NULL) + */ + void fill_g_error(GError **err) { + g_set_error(err, MU_ERROR_DOMAIN, static_cast(code_), + "%s", what_.c_str()); + } + +private: const Code code_; std::string what_; };