diff --git a/libsrc/core/exception.cpp b/libsrc/core/exception.cpp index a1909a7c..a1ed26f1 100644 --- a/libsrc/core/exception.cpp +++ b/libsrc/core/exception.cpp @@ -18,6 +18,26 @@ namespace ngcore { + + + Exception :: Exception(const std::string& s) + : m_what(s) {} + + Exception :: Exception(const char* s) + : m_what(s) {} + + + void ThrowException(const std::string & s) + { + throw Exception (s); + } + + void ThrowException(const char * s) + { + throw Exception (s); + } + + namespace detail { static int exec(std::string cmd, std::string & out) { diff --git a/libsrc/core/exception.hpp b/libsrc/core/exception.hpp index 406a4eb2..bfec7a75 100644 --- a/libsrc/core/exception.hpp +++ b/libsrc/core/exception.hpp @@ -31,8 +31,8 @@ namespace ngcore Exception() = default; Exception(const Exception&) = default; Exception(Exception&&) = default; - Exception(const std::string& s) : m_what(s) {} - Exception(const char* s) : m_what(s) {} + Exception(const std::string& s); // : m_what(s) {} + Exception(const char* s); // : m_what(s) {} ~Exception() override = default; Exception& operator =(const Exception&) = default; @@ -49,7 +49,10 @@ namespace ngcore /// implement virtual function of std::exception const char* what() const noexcept override { return m_what.c_str(); } }; - + + NGCORE_API void ThrowException(const std::string & s); + NGCORE_API void ThrowException(const char * s); + // Out of Range exception class NGCORE_API RangeException : public Exception {