8#define ALIGATOR_RUNTIME_ERROR(...) \
9 throw ::aligator::RuntimeError( \
10 ::aligator::detail::exception_msg(__FILE__, __LINE__, __VA_ARGS__))
12#define ALIGATOR_OUT_OF_RANGE_ERROR(...) \
13 throw ::std::out_of_range( \
14 ::aligator::detail::exception_msg(__FILE__, __LINE__, __VA_ARGS__))
16#define ALIGATOR_DOMAIN_ERROR(...) \
17 throw ::std::domain_error( \
18 ::aligator::detail::exception_msg(__FILE__, __LINE__, __VA_ARGS__))
20#define ALIGATOR_WARNING(loc, ...) \
21 ::aligator::detail::warning_call(loc, __FUNCTION__, __VA_ARGS__)
25void warning_impl(
const char *loc,
const char *fun, fmt::string_view fstr,
26 fmt::format_args args);
27template <
typename... T>
28void warning_call(
const char *loc,
const char *fun,
29 fmt::format_string<T...> fstr, T &&...args) {
30 warning_impl(loc, fun, fstr, fmt::make_format_args(args...));
33void warning_call(
const char *loc,
const char *fun, T &&msg) {
34 warning_impl(loc, fun, msg, {});
37std::string exception_msg_impl(
const char *filename,
int lineno,
38 fmt::string_view fstr, fmt::format_args args);
39template <
typename... T>
40std::string exception_msg(
const char *filename,
int lineno,
41 fmt::format_string<T...> fstr, T &&...args) {
42 return exception_msg_impl(filename, lineno, fstr,
43 fmt::make_format_args(args...));
50 : std::runtime_error(what) {}
RuntimeError(const std::string &what)