Flow123d  release_2.2.0-914-gf1a3a4f
Classes | Namespaces | Macros | Functions
exceptions.hh File Reference
#include <stdlib.h>
#include <boost/exception/detail/error_info_impl.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/exception.hpp>
#include <boost/exception/get_error_info.hpp>
#include <boost/throw_exception.hpp>
#include <exception>
#include <type_traits>
#include <vector>
#include <iostream>
#include <string>
#include <memory>
#include "system/stack_trace.hh"

Go to the source code of this file.

Classes

class  ExceptionBase
 Base of exceptions used in Flow123d. More...
 
class  EI< Tag, Type >
 
class  internal::NullOutputEnvelope< Type >
 
class  internal::ExcStream
 

Namespaces

 internal
 

Macros

#define THROW(whole_exception_expr)   BOOST_THROW_EXCEPTION( whole_exception_expr)
 Wrapper for throw. Saves the throwing point. More...
 
#define DECLARE_EXCEPTION(ExcName, Format)
 Macro for simple definition of exceptions. More...
 
#define TYPEDEF_ERR_INFO(EI_Type, Type)   typedef EI< struct EI_Type##_TAG, Type > EI_Type
 Macro to simplify declaration of error_info types. More...
 

Functions

 TYPEDEF_ERR_INFO (EI_Nested, std::shared_ptr< ExceptionBase >)
 Error info of previous exception. More...
 
 TYPEDEF_ERR_INFO (EI_NestedMessage, std::string)
 
template<class Exc >
EI_Nested make_nested_ei (Exc &e)
 
template<class Exc >
EI_NestedMessage make_nested_message (Exc &e)
 
template<class Type >
std::ostream & internal::operator<< (std::ostream &stream, const NullOutputEnvelope< Type > &value)
 
template<class T >
ExcStream & internal::operator<< (ExcStream &estream, const T &x)
 
template<class Tag , class Type , class Func >
internal::ExcStreaminternal::operator<< (internal::ExcStream &estream, typename EI< Tag, Type >::template lambda< Func > const &lambda_func)
 
 TYPEDEF_ERR_INFO (EI_XprintfHeader, std::string)
 
 TYPEDEF_ERR_INFO (EI_XprintfMessage, std::string)
 
 DECLARE_EXCEPTION (ExcXprintfMsg,<< EI_XprintfHeader::val<< EI_XprintfMessage::val)
 

Detailed Description

 * Copyright (C) 2015 Technical University of Liberec. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Definition in file exceptions.hh.

Function Documentation

DECLARE_EXCEPTION ( ExcXprintfMsg  ,
<< EI_XprintfHeader::val<< EI_XprintfMessage::val   
)
template<class Exc >
EI_Nested make_nested_ei ( Exc &  e)

Create EI_Nested error info with given exception.

Used for propagation exception message.

Definition at line 272 of file exceptions.hh.

Here is the caller graph for this function:

template<class Exc >
EI_NestedMessage make_nested_message ( Exc &  e)

Propagate just the 'what' message for exceptions that are not derived from ExceptionBase.

Definition at line 285 of file exceptions.hh.

Here is the caller graph for this function:

TYPEDEF_ERR_INFO ( EI_Nested  ,
std::shared_ptr< ExceptionBase  
)

Error info of previous exception.

Allows keep and propagate message when one exception is catched and other exception is thrown. Catched exception is stored to EI_Nested and is printed out to message of thrown exception.

Example of usage:

1 try {
2  // method next() throws ExcA
3  obj.next();
4 } catch ( ExcA &e ) {
5  // add ExcA to EI tags of ExcB
6  THROW( ExcB() << make_nested_ei(e)) );
7 }
TYPEDEF_ERR_INFO ( EI_NestedMessage  ,
std::string   
)
TYPEDEF_ERR_INFO ( EI_XprintfHeader  ,
std::string   
)

Exception thrown in xprintf function.

TYPEDEF_ERR_INFO ( EI_XprintfMessage  ,
std::string   
)