diff --git a/include/anthem/Exception.h b/include/anthem/Exception.h index 51986c4..96902b8 100644 --- a/include/anthem/Exception.h +++ b/include/anthem/Exception.h @@ -19,11 +19,20 @@ namespace anthem class Exception: public std::exception { public: - Exception() = delete; - Exception(const Exception &other) = delete; - Exception &operator=(const Exception &other) = delete; - Exception(Exception &&other) = default; - Exception &operator=(Exception &&other) = default; + explicit Exception() + : Exception("unspecified parser error") + { + } + + explicit Exception(const char *message) + : Exception(static_cast(message)) + { + } + + explicit Exception(const std::string &message) + : m_message{message} + { + } explicit Exception(const Location &location) : Exception(location, "unspecified error") @@ -44,6 +53,11 @@ class Exception: public std::exception { } + Exception(const Exception &other) = delete; + Exception &operator=(const Exception &other) = delete; + Exception(Exception &&other) = default; + Exception &operator=(Exception &&other) = default; + ~Exception() noexcept = default; const char *what() const noexcept