userver: userver/utils/assert.hpp File Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
assert.hpp File Reference

Detailed Description

Assertion macros UASSERT, UASSERT_MSG, UINVARIANT and AbortWithStacktrace() function.

Definition in file assert.hpp.

Go to the source code of this file.

#include <string_view>
#include <userver/utils/impl/source_location.hpp>

Namespaces

namespace  utils
 Utilities.
 

Macros

#define UASSERT_MSG(expr, msg)
 Assertion macro for that aborts execution in DEBUG builds with a message msg and does nothing in release builds.
 
#define UASSERT(expr)
 Assertion macro that aborts execution in DEBUG builds and does nothing in release builds.
 
#define UINVARIANT(condition, message)
 Asserts in debug builds, throws utils::InvariantError in release.
 

Functions

void utils::AbortWithStacktrace (std::string_view message) noexcept
 Function that prints the stacktrace with message and aborts the program execution.
 

Macro Definition Documentation

◆ UASSERT

#define UASSERT ( expr)

Assertion macro that aborts execution in DEBUG builds and does nothing in release builds.

Examples
samples/http_caching/main.cpp.

Definition at line 70 of file assert.hpp.

◆ UASSERT_MSG

#define UASSERT_MSG ( expr,
msg )

Assertion macro for that aborts execution in DEBUG builds with a message msg and does nothing in release builds.

Examples
samples/flatbuf_service/main.cpp.

Definition at line 55 of file assert.hpp.

◆ UINVARIANT

#define UINVARIANT ( condition,
message )