WPILibC++
2027.0.0-alpha-4
Loading...
Searching...
No Matches
assert.hpp
Go to the documentation of this file.
1
// Copyright (c) Sleipnir contributors
2
3
#pragma once
4
5
#ifdef SLEIPNIR_PYTHON
6
#include <source_location>
7
#include <stdexcept>
8
9
#include <
fmt/format.h
>
10
11
/// Throw an exception in Python.
12
#define slp_assert(condition) \
13
do { \
14
if (!(condition)) { \
15
auto location = std::source_location::current(); \
16
throw std::invalid_argument(fmt::format( \
17
"{}:{}: {}: Assertion `{}' failed.", location.file_name(), \
18
location.line(), location.function_name(), #condition)); \
19
} \
20
} while (0)
21
#else
22
#include <cassert>
23
24
/// Abort in C++.
25
#define slp_assert(condition) assert(condition)
26
#endif
format.h
thirdparty
sleipnir
include
sleipnir
util
assert.hpp
Generated on
for WPILibC++ by
1.15.0