aligator
0.19.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Toggle main menu visibility
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <stdexcept>
4
#include <string>
5
#include <fmt/core.h>
6
#include <fmt/format.h>
7
8
#define ALIGATOR_RUNTIME_ERROR(...) \
9
throw ::aligator::RuntimeError( \
10
::aligator::detail::exception_msg(__FILE__, __LINE__, __VA_ARGS__))
11
12
#define ALIGATOR_OUT_OF_RANGE_ERROR(...) \
13
throw ::std::out_of_range( \
14
::aligator::detail::exception_msg(__FILE__, __LINE__, __VA_ARGS__))
15
16
#define ALIGATOR_DOMAIN_ERROR(...) \
17
throw ::std::domain_error( \
18
::aligator::detail::exception_msg(__FILE__, __LINE__, __VA_ARGS__))
19
20
#define ALIGATOR_WARNING(loc, ...) \
21
::aligator::detail::warning_call(loc, __FUNCTION__, __VA_ARGS__)
22
23
namespace
aligator
{
24
namespace
detail {
25
void
warning_impl(
const
char
*loc,
const
char
*fun, fmt::string_view fstr,
26
fmt::format_args args);
27
template
<
typename
... T>
28
void
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...));
31
}
32
template
<
typename
T>
33
void
warning_call(
const
char
*loc,
const
char
*fun, T &&msg) {
34
warning_impl(loc, fun, msg, {});
35
}
36
37
std::string exception_msg_impl(
const
char
*filename,
int
lineno,
38
fmt::string_view fstr, fmt::format_args args);
39
template
<
typename
... T>
40
std::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...));
44
}
45
}
// namespace detail
46
47
class
RuntimeError
:
public
std::runtime_error {
48
public
:
49
explicit
RuntimeError
(
const
std::string &what)
50
: std::runtime_error(what) {}
51
};
52
53
}
// namespace aligator
aligator::RuntimeError::RuntimeError
RuntimeError(const std::string &what)
Definition
exceptions.hpp:49
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
include
aligator
utils
exceptions.hpp
Generated by
1.17.0