Finalize AL_SOFT_events
[openal-soft.git] / common / alexcpt.h
blob5b33f0925b506c4821bd5aba9639af54b04925e2
1 #ifndef ALEXCPT_H
2 #define ALEXCPT_H
4 #include <cstdarg>
5 #include <exception>
6 #include <string>
7 #include <utility>
9 #include "AL/alc.h"
12 namespace al {
14 class base_exception : public std::exception {
15 std::string mMessage;
16 ALCenum mErrorCode;
18 protected:
19 base_exception(ALCenum code) : mErrorCode{code} { }
20 virtual ~base_exception();
22 void setMessage(const char *msg, std::va_list args);
24 public:
25 const char *what() const noexcept override { return mMessage.c_str(); }
26 ALCenum errorCode() const noexcept { return mErrorCode; }
29 } // namespace al
31 #define START_API_FUNC try
33 #define END_API_FUNC catch(...) { std::terminate(); }
35 #endif /* ALEXCPT_H */