Error processing, assertions, contracts, results.
More...
|
| class | sen::Result< T, E > |
| | Result<T, E> is a template type that can be used to return and propagate errors. The intent is to replace exceptions in this context. Result<T, E> is an algebraic data type of Ok(T) that represents success and Err(E) representing an error. More...
|
|
| #define | SEN_EXPECT(expr) |
| | Checks a pre-condition of a procedure (function parameter for example). NOLINTNEXTLINE.
|
| #define | SEN_ASSERT(expr) |
| | Checks an intermediate result produced by a procedure (not an input or output). NOLINTNEXTLINE.
|
| #define | SEN_ENSURE(expr) |
| | Checks a post-condition of a procedure (function return value for example). NOLINTNEXTLINE.
|
|
| void | sen::registerTerminateHandler () |
| | Installs a custom termination handler.
|
| void | sen::throwRuntimeError (const std::string &err) |
| | Throws std::exception that attempts to collect the stack trace. We also wrap it to avoid including stdexcept.
|
| void | sen::trace () |
| | Prints the current stack trace to stderr.
|
| void | sen::trace (std::string preMessage) |
| | Prints the current stack trace to stderr.
|
| template<typename T, typename CleanT = std::decay_t<T>> |
| impl::Ok< CleanT > | sen::Ok (T &&val) noexcept |
| | Helper (syntactic sugar) to create Results that indicate success.
|
| template<typename E, typename CleanE = std::decay_t<E>> |
| impl::Err< CleanE > | sen::Err (E &&val) noexcept |
| | Helper (syntactic sugar) to create Results that indicate error.
|
| impl::Ok< void > | sen::Ok () noexcept |
| | If T is void, use the void specialization of Ok.
|
| impl::Err< void > | sen::Err () noexcept |
| | If E is void, use the void specialization of Err.
|
Error processing, assertions, contracts, results.
◆ SEN_EXPECT
| #define SEN_EXPECT |
( |
| expr | ) |
|
Value:::sen::impl::senCheckImpl((expr), ::sen::impl::CheckType::expect, #expr,
SEN_SL())
#define SEN_SL()
Convenience macro including the source location info. NOLINTNEXTLINE(cppcoreguidelines-macro-usage).
Definition source_location.h:62
Checks a pre-condition of a procedure (function parameter for example). NOLINTNEXTLINE.
◆ SEN_ASSERT
| #define SEN_ASSERT |
( |
| expr | ) |
|
Value:::sen::impl::senCheckImpl((expr), ::sen::impl::CheckType::assert, #expr,
SEN_SL())
Checks an intermediate result produced by a procedure (not an input or output). NOLINTNEXTLINE.
◆ SEN_ENSURE
| #define SEN_ENSURE |
( |
| expr | ) |
|
Value:::sen::impl::senCheckImpl((expr), ::sen::impl::CheckType::ensure, #expr,
SEN_SL())
Checks a post-condition of a procedure (function return value for example). NOLINTNEXTLINE.
◆ BoolResult
◆ registerTerminateHandler()
| void sen::registerTerminateHandler |
( |
| ) |
|
Installs a custom termination handler.
◆ throwRuntimeError()
| void sen::throwRuntimeError |
( |
const std::string & | err | ) |
|
Throws std::exception that attempts to collect the stack trace. We also wrap it to avoid including stdexcept.
◆ trace() [1/2]
Prints the current stack trace to stderr.
◆ trace() [2/2]
| void sen::trace |
( |
std::string | preMessage | ) |
|
Prints the current stack trace to stderr.
- Parameters
-
| preMessage | that is printed in the line before the stacktrace |
◆ Ok() [1/2]
template<typename T, typename CleanT = std::decay_t<T>>
| impl::Ok< CleanT > sen::Ok |
( |
T && | val | ) |
|
|
inlinenoexcept |
Helper (syntactic sugar) to create Results that indicate success.
◆ Err() [1/2]
template<typename E, typename CleanE = std::decay_t<E>>
| impl::Err< CleanE > sen::Err |
( |
E && | val | ) |
|
|
inlinenoexcept |
Helper (syntactic sugar) to create Results that indicate error.
◆ Ok() [2/2]
| impl::Ok< void > sen::Ok |
( |
| ) |
|
|
inlinenodiscardnoexcept |
If T is void, use the void specialization of Ok.
◆ Err() [2/2]
| impl::Err< void > sen::Err |
( |
| ) |
|
|
inlinenodiscardnoexcept |
If E is void, use the void specialization of Err.