#pragma once #include namespace phosphor { namespace inventory { namespace manager { // TODO: Use proper error generation techniques // https://github.com/openbmc/openbmc/issues/1125 /** @class InterfaceError * @brief Exception class for unrecognized interfaces. */ class InterfaceError final : public std::invalid_argument { public: ~InterfaceError() = default; InterfaceError() = delete; InterfaceError(const InterfaceError&) = delete; InterfaceError(InterfaceError&&) = default; InterfaceError& operator=(const InterfaceError&) = delete; InterfaceError& operator=(InterfaceError&&) = default; /** @brief Construct an interface error. * * @param[in] msg - The message to be returned by what(). * @param[in] iface - The failing interface name. */ InterfaceError(const char* msg, const std::string& iface) : std::invalid_argument(msg), interface(iface) { } /** @brief Log the exception message to the systemd journal. */ void log() const; private: std::string interface; }; } // namespace manager } // namespace inventory } // namespace phosphor // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4