Make a couple more functions private
[openal-soft.git] / common / alexcpt.h
blobff09bab2499ffdc8374658cc57afebe26e426b33
1 #ifndef ALEXCPT_H
2 #define ALEXCPT_H
4 #include <exception>
5 #include <string>
7 #include "AL/alc.h"
10 #ifdef __GNUC__
11 #define ALEXCPT_FORMAT(x, y, z) __attribute__((format(x, (y), (z))))
12 #else
13 #define ALEXCPT_FORMAT(x, y, z)
14 #endif
17 namespace al {
19 class backend_exception final : public std::exception {
20 std::string mMessage;
21 ALCenum mErrorCode;
23 public:
24 backend_exception(ALCenum code, const char *msg, ...) ALEXCPT_FORMAT(printf, 3,4);
26 const char *what() const noexcept override { return mMessage.c_str(); }
27 ALCenum errorCode() const noexcept { return mErrorCode; }
30 } // namespace al
32 #define START_API_FUNC try
34 #define END_API_FUNC catch(...) { std::terminate(); }
36 #endif /* ALEXCPT_H */