Combine some duplicate code to mix each channel
[openal-soft.git] / core / except.h
blobaf7257bfd2545aa5a0c22513820800dd89b4fa73
1 #ifndef CORE_EXCEPT_H
2 #define CORE_EXCEPT_H
4 #include <cstdarg>
5 #include <exception>
6 #include <string>
7 #include <utility>
10 namespace al {
12 class base_exception : public std::exception {
13 std::string mMessage;
15 protected:
16 base_exception() = default;
17 virtual ~base_exception() = default;
19 void setMessage(const char *msg, std::va_list args);
21 public:
22 const char *what() const noexcept override { return mMessage.c_str(); }
25 } // namespace al
27 #define START_API_FUNC try
29 #define END_API_FUNC catch(...) { std::terminate(); }
31 #endif /* CORE_EXCEPT_H */