Rosetta
Functions
backtrace.cc File Reference

Instead of printing a backtrace inside of an assertion failure, throw an exception. More...

#include <utility/backtrace.hh>
#include <utility/crash_report.hh>
#include <utility/excn/Exceptions.hh>
#include <utility/CSI_Sequence.hh>
#include <iostream>
#include <sstream>

Functions

static bool throw_the_next_time_an_assertion_failure_is_hit (false)
 
void set_throw_on_next_assertion_failure ()
 Function for unit testing only – if an assertion failure is hit, throw an exception instead of exiting. Don't let me catch you calling this function from anywhere besides a unit test. Punishment will be swift. More...
 
bool maybe_throw_on_next_assertion_failure (char const *condition)
 Throw an exception if set_throw_on_next_assertion_failure was called since the last time this function was called. More...
 
bool handle_assert_failure (char const *condition, std::string const &file, int const line)
 

Detailed Description

Instead of printing a backtrace inside of an assertion failure, throw an exception.

Author
Andrew Leaver-Fay (aleav.nosp@m.erfa.nosp@m.y@gma.nosp@m.il.c.nosp@m.om)

Function Documentation

◆ handle_assert_failure()

bool handle_assert_failure ( char const *  condition,
std::string const &  file,
int const  line 
)

◆ maybe_throw_on_next_assertion_failure()

bool maybe_throw_on_next_assertion_failure ( char const *  condition)

Throw an exception if set_throw_on_next_assertion_failure was called since the last time this function was called.

References CREATE_EXCEPTION, and throw_the_next_time_an_assertion_failure_is_hit().

Referenced by utility::exit_handler(), and handle_assert_failure().

◆ set_throw_on_next_assertion_failure()

void set_throw_on_next_assertion_failure ( )

Function for unit testing only – if an assertion failure is hit, throw an exception instead of exiting. Don't let me catch you calling this function from anywhere besides a unit test. Punishment will be swift.

References throw_the_next_time_an_assertion_failure_is_hit().

◆ throw_the_next_time_an_assertion_failure_is_hit()

static bool throw_the_next_time_an_assertion_failure_is_hit ( false  )
static