blob: 78db37c7cbf39f0f5ae3d12f4842e5927af40da4 [file] [log] [blame]
Shawn McCarney487e2e12024-11-25 17:19:46 -06001#pragma once
2
3#include <exception>
4#include <string>
5
6namespace phosphor::software::updater
7{
8
9/**
10 * @class RuntimeWarning
11 *
12 * Exception class to report a runtime warning condition.
13 */
14class 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 */
29 explicit RuntimeWarning(const std::string& error) : error{error} {}
30
31 /** @brief Returns the description of this error.
32 *
33 * @return error description
34 */
35 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