Skip to content

Commit

Permalink
feat: Add new assertm macro
Browse files Browse the repository at this point in the history
This allows to add a message to the assertion which can improve
readability of error diagnostics.
  • Loading branch information
dennisklein authored and rbx committed Oct 19, 2021
1 parent b8503bf commit 8796ce5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fairmq/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8796ce5

Please sign in to comment.