1 #pragma once 2 3 #include <stdexcept> 4 5 namespace phosphor 6 { 7 namespace inventory 8 { 9 namespace manager 10 { 11 12 // TODO: Use proper error generation techniques 13 // https://github.com/openbmc/openbmc/issues/1125 14 15 /** @class InterfaceError 16 * @brief Exception class for unrecognized interfaces. 17 */ 18 class InterfaceError final : public std::invalid_argument 19 { 20 public: 21 ~InterfaceError() = default; 22 InterfaceError() = delete; 23 InterfaceError(const InterfaceError&) = delete; 24 InterfaceError(InterfaceError&&) = default; 25 InterfaceError& operator=(const InterfaceError&) = delete; 26 InterfaceError& operator=(InterfaceError&&) = default; 27 28 /** @brief Construct an interface error. 29 * 30 * @param[in] msg - The message to be returned by what(). 31 * @param[in] iface - The failing interface name. 32 */ InterfaceError(const char * msg,const std::string & iface)33 InterfaceError(const char* msg, const std::string& iface) : 34 std::invalid_argument(msg), interface(iface) 35 {} 36 37 /** @brief Log the exception message to the systemd journal. */ 38 void log() const; 39 40 private: 41 std::string interface; 42 }; 43 44 } // namespace manager 45 } // namespace inventory 46 } // namespace phosphor 47