🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
717 B

  1. #ifndef ALEXCPT_H
  2. #define ALEXCPT_H
  3. #include <exception>
  4. #include <string>
  5. #include "AL/alc.h"
  6. #ifdef __GNUC__
  7. #define ALEXCPT_FORMAT(x, y, z) __attribute__((format(x, (y), (z))))
  8. #else
  9. #define ALEXCPT_FORMAT(x, y, z)
  10. #endif
  11. namespace al {
  12. class backend_exception final : public std::exception {
  13. std::string mMessage;
  14. ALCenum mErrorCode;
  15. public:
  16. backend_exception(ALCenum code, const char *msg, ...) ALEXCPT_FORMAT(printf, 3,4);
  17. const char *what() const noexcept override { return mMessage.c_str(); }
  18. ALCenum errorCode() const noexcept { return mErrorCode; }
  19. };
  20. } // namespace al
  21. #define START_API_FUNC try
  22. #define END_API_FUNC catch(...) { std::terminate(); }
  23. #endif /* ALEXCPT_H */