feat: Add new assertm macro

This allows to add a message to the assertion which can improve
readability of error diagnostics.
This commit is contained in:
Dennis Klein 2021-10-13 15:10:00 +02:00
parent 0a3e39e48f
commit b0d4d6c6e3

View File

@ -9,10 +9,15 @@
#ifndef FAIR_MQ_ERROR_H
#define FAIR_MQ_ERROR_H
#include <cassert>
#include <fairmq/tools/Strings.h>
#include <stdexcept>
#include <system_error>
// Macro copied from https://en.cppreference.com/w/cpp/error/assert
// Use (void) to silent unused warnings.
#define assertm(exp, msg) assert(((void)msg, exp))
namespace fair::mq {
struct RuntimeError : ::std::runtime_error