OpenCAP
Electronic structure of metastable states
Classes | Macros | Functions
opencap_exception.h File Reference

Exception handling adapted from: https://github.com/GPMueller/mwe-cpp-exception. Copyright (c) 2016 Gideon Müller More...

#include <stdexcept>
#include <string>

Go to the source code of this file.

Classes

class  Exception
 Class for handling nested exceptions. Adapted from: https://github.com/GPMueller/mwe-cpp-exception. More...
 

Macros

#define opencap_throw(message)   throw Exception(message, __FILE__, __LINE__);
 
#define opencap_rethrow(message)   rethrow(message, __FILE__, __LINE__);
 
#define opencap_handle_exception(ex)   Handle_Exception(ex, __func__);
 

Functions

void rethrow (const std::string &message, const char *file, unsigned int line)
 
void Handle_Exception (const std::exception &ex, const std::string &function)
 

Detailed Description

Exception handling adapted from: https://github.com/GPMueller/mwe-cpp-exception. Copyright (c) 2016 Gideon Müller

Macro Definition Documentation

◆ opencap_handle_exception

#define opencap_handle_exception (   ex)    Handle_Exception(ex, __func__);

◆ opencap_rethrow

#define opencap_rethrow (   message)    rethrow(message, __FILE__, __LINE__);

◆ opencap_throw

#define opencap_throw (   message)    throw Exception(message, __FILE__, __LINE__);

Function Documentation

◆ Handle_Exception()

void Handle_Exception ( const std::exception &  ex,
const std::string &  function 
)

General exception handler

◆ rethrow()

void rethrow ( const std::string &  message,
const char *  file,
unsigned int  line 
)

Rethrow (creates a std::nested_exception) an exception, using the Exception class which contains file and line info. The original exception is preserved...