ATLAS Offline Software
Loading...
Searching...
No Matches
ReturnCheck.h File Reference
#include <TError.h>
#include "AsgMessaging/StatusCode.h"
#include "xAODRootAccess/tools/Message.h"
Include dependency graph for ReturnCheck.h:

Go to the source code of this file.

Macros

#define RETURN_CHECK(CONTEXT, EXP)
 Helper macro for checking return codes in a compact form in the code.

Macro Definition Documentation

◆ RETURN_CHECK

#define RETURN_CHECK ( CONTEXT,
EXP )
Value:
do { \
const auto result = EXP; \
if( ! result.isSuccess() ) { \
::Error( CONTEXT, XAOD_MESSAGE( "Failed to execute: %s" ), \
#EXP ); \
return result; \
} \
} while( false )
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.

Helper macro for checking return codes in a compact form in the code.

This is pretty much a rip-off of the (ATH_)CHECK macros of the offline code. It is used in the package in functions that return a StatusCode, and themselves call functions returning StatusCode.

Parameters
CONTEXTA context string to print an error message on failure
EXPThe expression to execute in a checked manner

Definition at line 26 of file ReturnCheck.h.

26#define RETURN_CHECK( CONTEXT, EXP ) \
27 do { \
28 const auto result = EXP; \
29 if( ! result.isSuccess() ) { \
30 ::Error( CONTEXT, XAOD_MESSAGE( "Failed to execute: %s" ), \
31 #EXP ); \
32 return result; \
33 } \
34 } while( false )