2020-12-21 18:00:43 -08:00
|
|
|
#ifndef CORE_EXCEPT_H
|
|
|
|
#define CORE_EXCEPT_H
|
2019-04-09 20:48:01 -07:00
|
|
|
|
2020-04-10 15:11:40 -07:00
|
|
|
#include <cstdarg>
|
2019-04-09 20:48:01 -07:00
|
|
|
#include <exception>
|
2019-05-04 18:03:25 -07:00
|
|
|
#include <string>
|
2020-04-10 15:11:40 -07:00
|
|
|
#include <utility>
|
2019-04-09 20:48:01 -07:00
|
|
|
|
2019-05-04 18:03:25 -07:00
|
|
|
|
|
|
|
namespace al {
|
|
|
|
|
2020-04-10 15:11:40 -07:00
|
|
|
class base_exception : public std::exception {
|
2019-05-04 18:03:25 -07:00
|
|
|
std::string mMessage;
|
|
|
|
|
2020-04-10 15:11:40 -07:00
|
|
|
protected:
|
2020-12-17 16:46:21 -08:00
|
|
|
base_exception() = default;
|
2020-04-14 11:50:59 -07:00
|
|
|
virtual ~base_exception();
|
2019-05-04 18:03:25 -07:00
|
|
|
|
2020-04-10 15:11:40 -07:00
|
|
|
void setMessage(const char *msg, std::va_list args);
|
|
|
|
|
|
|
|
public:
|
2019-05-04 18:03:25 -07:00
|
|
|
const char *what() const noexcept override { return mMessage.c_str(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace al
|
2019-04-09 20:48:01 -07:00
|
|
|
|
|
|
|
#define START_API_FUNC try
|
|
|
|
|
|
|
|
#define END_API_FUNC catch(...) { std::terminate(); }
|
|
|
|
|
2020-12-21 18:00:43 -08:00
|
|
|
#endif /* CORE_EXCEPT_H */
|