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