12 #ifndef CARNAEXCEPTION_H_6014714286
13 #define CARNAEXCEPTION_H_6014714286
21 #include <Carna/Carna.h>
53 CarnaException(
const std::string& type,
const std::string& message,
const std::string& details =
"" );
57 CarnaException(
const std::logic_error& error,
const std::string& details =
"" );
61 CarnaException(
const std::runtime_error& error,
const std::string& details =
"" );
131 static void enable();
135 static void disable();
139 static bool isEnabled();
160 #define CARNA_BREAK_FOR_DEBUG \
161 if( ::Carna::base::BreakForDebug::isEnabled() ) \
166 #define CARNA_BREAK_FOR_DEBUG \
167 if( ::Carna::base::BreakForDebug::isEnabled() ) \
169 std::raise( SIGINT ); \
173 #define CARNA_BREAK_FOR_DEBUG
188 #define CARNA_FAIL( description ) \
189 CARNA_BREAK_FOR_DEBUG \
191 std::stringstream details; \
193 << "Description: " << description << std::endl \
194 << "File: " << __FILE__ << std::endl \
195 << "Line: " << __LINE__; \
196 throw ::Carna::base::AssertionFailure( details.str() ); \
212 #define CARNA_ASSERT( expression ) \
213 if( !( expression ) ) \
215 CARNA_BREAK_FOR_DEBUG \
216 std::stringstream details; \
218 << "Failed expression: " << #expression << std::endl \
219 << "File: " << __FILE__ << std::endl \
220 << "Line: " << __LINE__; \
221 throw ::Carna::base::AssertionFailure( details.str() ); \
237 #define CARNA_ASSERT_EX( expression, description ) \
238 if( !( expression ) ) \
240 CARNA_BREAK_FOR_DEBUG \
241 std::stringstream details; \
243 << "Failed expression: " << #expression << std::endl \
244 << "Description: " << description << std::endl \
245 << "File: " << __FILE__ << std::endl \
246 << "Line: " << __LINE__; \
247 throw ::Carna::base::AssertionFailure( details.str() ); \
256 #endif // CARNAEXCEPTION_H_6014714286
Carna exception that indicates a failed assertion.
Base exception class that provides distinct attributes for the type (category) of the exception...
const std::string message
Tells the message of this exception.
Controls whether the CARNA_BREAK_FOR_DEBUG macro produces a break point or not.
const std::string type
Tells the type (category) of this exception.
const std::string details
Tells the details of this exception. May be empty.