1 #pragma once
2 
3 #include <exception>
4 #include <string>
5 
6 namespace phosphor::software::updater
7 {
8 
9 /**
10  * @class RuntimeWarning
11  *
12  * Exception class to report a runtime warning condition.
13  */
14 class RuntimeWarning : public std::exception
15 {
16   public:
17     // Specify which compiler-generated methods we want
18     RuntimeWarning() = delete;
19     RuntimeWarning(const RuntimeWarning&) = default;
20     RuntimeWarning(RuntimeWarning&&) = default;
21     RuntimeWarning& operator=(const RuntimeWarning&) = default;
22     RuntimeWarning& operator=(RuntimeWarning&&) = default;
23     ~RuntimeWarning() override = default;
24 
25     /** @brief Constructor.
26      *
27      * @param error error message
28      */
RuntimeWarning(const std::string & error)29     explicit RuntimeWarning(const std::string& error) : error{error} {}
30 
31     /** @brief Returns the description of this error.
32      *
33      * @return error description
34      */
what() const35     const char* what() const noexcept override
36     {
37         return error.c_str();
38     }
39 
40   private:
41     /** @brief Error message */
42     std::string error;
43 };
44 
45 } // namespace phosphor::software::updater
46