Skip to content

Commit 5d78642

Browse files
committed
chore: Error is an exception
1 parent e89a07a commit 5d78642

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

include/mrdox/Support/Error.hpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <mrdox/Platform.hpp>
1616
#include <fmt/format.h>
17+
#include <exception>
1718
#include <string>
1819
#include <string_view>
1920
#include <type_traits>
@@ -24,7 +25,8 @@ namespace mrdox {
2425

2526
/** Holds the description of an error, or success.
2627
*/
27-
class [[nodiscard]] Error
28+
class [[nodiscard]] MRDOX_DECL
29+
Error : public std::exception
2830
{
2931
std::string text_;
3032

@@ -119,6 +121,14 @@ class [[nodiscard]] Error
119121
return text_;
120122
}
121123

124+
/** Return a null-terminated error string.
125+
*/
126+
char const*
127+
what() const noexcept override
128+
{
129+
return text_.c_str();
130+
}
131+
122132
/** Return a value indicating success.
123133
*/
124134
static

0 commit comments

Comments
 (0)