20 #ifndef PISM_ERROR_HANDLING_H
21 #define PISM_ERROR_HANDLING_H
28 #include "pism/pism_config.hh"
41 #define PISM_ERROR_LOCATION pism::ErrorLocation(__FILE__, __LINE__)
43 #define PISM_ERROR_LOCATION pism::ErrorLocation()
62 void print(MPI_Comm com);
83 void check_c_call(
int errcode,
int success,
const char* function_name,
84 const char *file,
int line);
87 const char *file,
int line);
89 #define PISM_C_CHK(errcode,success,name) do { pism::check_c_call(errcode, success, name, __FILE__, __LINE__); } while (0)
90 #define PISM_CHK(errcode,name) do { pism::check_petsc_call(errcode, name, __FILE__, __LINE__); } while (0)
~ParallelSection()=default
void(* Hook)(RuntimeError *)
RuntimeError(const ErrorLocation &location, const std::string &message)
static RuntimeError static void set_hook(Hook new_hook)
void add_context(const std::string &message)
Add a message providing some context. This way we can (sort of) get a stack trace even though C++ exc...
std::vector< std::string > m_context
void void print(MPI_Comm com)
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
static void check(const ErrorLocation &where, int return_code)
Prints an error message; for debugging.
std::string printf(const char *format,...)
void check_c_call(int errcode, int success, const char *function_name, const char *file, int line)
void handle_fatal_errors(MPI_Comm com)
void check_petsc_call(int errcode, const char *function_name, const char *file, int line)