Sierra Toolkit Version of the Day
Exception.hpp File Reference
#include <stdexcept>
#include <exception>
#include <new>
#include <typeinfo>
#include <string>
#include <vector>
#include <sstream>
#include <stk_util/stk_config.h>
#include <mpi.h>
#include <stk_util/environment/ReportHandler.hpp>
#include <stk_util/util/FeatureTest.hpp>
#include <stk_util/diag/String.hpp>
#include <stk_util/diag/StringUtil.hpp>
#include <stk_util/diag/Trace.hpp>
Include dependency graph for Exception.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  sierra::ParallelThrowRegistry
 Class ParallelThrowRegistry is a registry of known parallel exceptions. For the negotiation of parallel exceptions, each parallel exception must be registered. The class serves as the registry and registrar for the exceptions. More...
class  sierra::ExParallel
 Class ExParallel implements the features of a parallel exception. It is a std::string which stores the exception description. It also provides "put to" (operator;lt&;lt&) functions for appending the description with information. More...
class  sierra::ExTemp< T >
 Template ExTemp takes a zero argument exception and makes it into a parallel throwable and put-to-able (<<) exception. This exception may be caught with either the base class T type or the template ExTemp<T> type. More...
class  sierra::runtime_user_error
 Class runtime_user_error ... More...

Namespaces

namespace  sierra

Defines

#define StackTraceMessage   " exception thrown from "
#define ParallelStackTraceMessage   " parallel exception thrown from "
#define ParallelStackTrace   std::string(std::string(ParallelStackTraceMessage) + stk::source_relative_path(STR_TRACE))

Typedefs

typedef ExTemp< std::exception > sierra::Exception
 Defined in
typedef ExTemp
< std::bad_exception > 
sierra::BadException
 Defined in
typedef ExTemp< std::bad_alloc > sierra::BadAlloc
 Defined in <new>
typedef ExTemp< std::bad_typeid > sierra::BadTypeid
 Defined in <typeinfo>
typedef ExTemp< std::bad_cast > sierra::BadCast
 Defined in <typeinfo>
typedef ExTemp1
< std::ios_base::failure > 
sierra::IosBaseFailure
 Defined in <ios>
typedef ExTemp1< std::logic_error > sierra::LogicError
 Defined in <stdexcept>
typedef ExTemp1
< std::domain_error > 
sierra::DomainError
 Defined in <stdexcept>
typedef ExTemp1
< std::invalid_argument > 
sierra::InvalidArgument
 Defined in <stdexcept>
typedef ExTemp1
< std::length_error > 
sierra::LengthError
 Defined in <stdexcept>
typedef ExTemp1
< std::out_of_range > 
sierra::OutOfRange
 Defined in <stdexcept>
typedef ExTemp1
< std::runtime_error > 
sierra::RuntimeError
 Defined in <stdexcept>
typedef ExTemp1< std::range_error > sierra::RangeError
 Defined in <stdexcept>
typedef ExTemp1
< std::overflow_error > 
sierra::OverflowError
 Defined in <stdexcept>
typedef ExTemp1
< std::underflow_error > 
sierra::UnderflowError
 Defined in <stdexcept>
typedef ExTemp1
< runtime_user_error > 
sierra::RuntimeUserError

Functions

void sierra::register_stl_parallel_exceptions ()
 Member function register_stl_parallel_exceptions registers the stl exceptions with the parallel exception handler.
void sierra::set_exception ()
 Function set_exception is called on a single processor when an exception is caught. The next collective communication will propogate the exception to all processors. This flavor is called when an unknown exception (...) is caught.
void sierra::set_exception (std::exception &x)
 Function set_exception is called on a single processor when an exception is caught. The next collective communication will propogate the exception to all processors.
void sierra::set_exception (ExParallel &x)
 Function set_exception is called on a single processor when an exception is caught. The next collective communication will propogate the exception to all processors.
void sierra::sierra_exception_throw ()
 Member function sierra_exception_throw is called whenever a parallel exception is constructed. This acn be used as a breakpoint in a debugger if finding the magic throw symbol is too tricky.
void sierra::throw_copy (const std::exception &x, const std::string &message)
 Function throw_copy throws a copy of the exception. The exception is located in the parallel exception registry. This exception is cloned and thrown using the parallel exception's throw_copy member function.
void sierra::parallel_throw (MPI_Comm mpi_comm)
 Function parallel_throw throws a consistant exception in parallel. parallel_throw is called after the exception has been propagated to all processors. parallel_throw will decide which exception to rethrow in parallel on all processors.

Detailed Description

Exception Classes for SIERRA

This file defines all of the exception classes thrown in and managed by the SIERRA the framework. A SIERRA exception class is defined for each of the C++ standard exceptions, except for ios_base::failure. The ios_base::failure is omitted because it would require inclusion of the heavyweight <ios> header file.

The SIERRA exception types, their corresponding standard exception base type, and source of that standard exception base type are as follows.

It is important to note that the sierra exceptions do not follow the same hierachy as the std exceptions. All the sierra execeptions are derived from ExParallel and not from each other. Therefore, it is suggested that you catch only the std::exception & to catch all std and sierra or catch ExParallel & to catch all sierra exceptions. The throw_copy() function promotes std exceptions to the corresponding sierra exception.

  • typedef ExTemp1< std::ios_base::failure > IosBaseFailure; IosBaseFailure is declared in ExceptionIos.h in order to avoid including the ios header file in this header.

Any additional exception types should be derived from one of the above SIERRA exception classes.

To create a new exception, DO NOT subclass from a parallel exception. Create your new exception from derived from the STL exception class, then typedef your new exception to a parallel exception using the ExTemp or ExTemp1 template. Then, be sure to call the MyException::registerException() during application initialization.

Definition in file Exception.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines