Added more constructor options for exceptions.

This commit is contained in:
Patrick Lühne 2017-05-31 18:10:55 +02:00
parent 193b7f5c91
commit 830b8846d6
No known key found for this signature in database
GPG Key ID: 05F3611E97A70ABF
1 changed files with 19 additions and 5 deletions

View File

@ -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<std::string>(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