-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy patherrors.hpp
46 lines (38 loc) · 1.12 KB
/
errors.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#include <stdexcept>
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