Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Exception Class Reference

Base class for an exception. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/base/arccore/base/Exception.h>

Inheritance diagram for Arcane::Exception:
Collaboration diagram for Arcane::Exception:

Public Member Functions

Exceptionoperator= (const Exception &)=delete
 Exception (const String &name, const String &where)
 Exception (const String &name, const TraceInfo &where)
 Exception (const String &name, const String &awhere, const String &message)
 Exception (const String &name, const TraceInfo &trace, const String &message)
 Exception (const String &name, const String &where, const StackTrace &stack_trace)
 Exception (const String &name, const TraceInfo &where, const StackTrace &stack_trace)
 Exception (const String &name, const String &where, const String &message, const StackTrace &stack_trace)
 Exception (const String &name, const TraceInfo &trace, const String &message, const StackTrace &stack_trace)
 Exception (const Exception &)
 Copy constructor.
 ~Exception () ARCCORE_NOEXCEPT override
 Releases resources.
virtual void write (std::ostream &o) const
bool isCollective () const
 True if it is a collective error (concerns all processors).
void setCollective (bool v)
 Sets the collective state of the expression.
void setAdditionalInfo (const String &v)
 Sets the additional information.
const StringadditionalInfo () const
 Returns the additional information.
const StackTracestackTrace () const
 Call stack at the moment of the exception (requires a stacktrace service).
const StringstackTraceString () const
 Call stack at the moment of the exception (requires a stacktrace service).
const Stringmessage () const
 Exception message.
const Stringwhere () const
 Location of the exception.
const Stringname () const
 Name of the exception.

Static Public Member Functions

static bool hasPendingException ()
 Indicates if there are pending exceptions.
static void staticInit ()

Protected Member Functions

virtual void explain (std::ostream &o) const
 Explains the cause of the exception in the stream o.
void setMessage (const String &msg)
 Sets the exception message.

Private Member Functions

void _setStackTrace ()
void _setWhere (const TraceInfo &where)
void _checkExplainAndPause ()

Private Attributes

String m_name
String m_where
StackTrace m_stack_trace
String m_message
String m_additional_info
bool m_is_collective = false

Static Private Attributes

static std::atomic< Int32m_nb_pending_exception

Friends

std::ostream & operator<< (std::ostream &o, const Exception &ex)
 Output operator.

Detailed Description

Base class for an exception.

Exceptions are managed by the C++ try and catch code. All exceptions thrown in the code must derive from this class.

An exception can be collective. This means it will be thrown by all processors. In this case, it is possible to display only a single message and possibly stop the execution cleanly.

Definition at line 47 of file arccore/src/base/arccore/base/Exception.h.

Constructor & Destructor Documentation

◆ Exception() [1/9]

Arcane::Exception::Exception ( const String & name,
const String & where )

◆ Exception() [2/9]

Arcane::Exception::Exception ( const String & name,
const TraceInfo & where )

Constructs an exception of name name and sent from the function awhere.

Definition at line 128 of file arccore/src/base/arccore/base/Exception.cc.

◆ Exception() [3/9]

Arcane::Exception::Exception ( const String & name,
const String & awhere,
const String & message )

Constructs an exception of name name, sent from the function awhere and with the message message.

Definition at line 85 of file arccore/src/base/arccore/base/Exception.cc.

◆ Exception() [4/9]

Arcane::Exception::Exception ( const String & name,
const TraceInfo & trace,
const String & message )

Constructs an exception of name name, sent from the function where and with the message message.

Definition at line 141 of file arccore/src/base/arccore/base/Exception.cc.

◆ Exception() [5/9]

Arcane::Exception::Exception ( const String & name,
const String & where,
const StackTrace & stack_trace )

Constructs an exception of name name and sent from the function where.

Definition at line 99 of file arccore/src/base/arccore/base/Exception.cc.

◆ Exception() [6/9]

Arcane::Exception::Exception ( const String & name,
const TraceInfo & where,
const StackTrace & stack_trace )

Constructs an exception of name name and sent from the function where.

Definition at line 156 of file arccore/src/base/arccore/base/Exception.cc.

◆ Exception() [7/9]

Arcane::Exception::Exception ( const String & name,
const String & where,
const String & message,
const StackTrace & stack_trace )

Constructs an exception of name name, sent from the function where and with the message message.

Definition at line 113 of file arccore/src/base/arccore/base/Exception.cc.

◆ Exception() [8/9]

Arcane::Exception::Exception ( const String & name,
const TraceInfo & trace,
const String & message,
const StackTrace & stack_trace )

Constructs an exception of name name, sent from the function where and with the message message.

Definition at line 171 of file arccore/src/base/arccore/base/Exception.cc.

◆ Exception() [9/9]

Arcane::Exception::Exception ( const Exception & from)

Copy constructor.

Definition at line 187 of file arccore/src/base/arccore/base/Exception.cc.

References Exception().

Here is the call graph for this function:

◆ ~Exception()

Arcane::Exception::~Exception ( )
override

Releases resources.

Definition at line 202 of file arccore/src/base/arccore/base/Exception.cc.

Member Function Documentation

◆ _checkExplainAndPause()

void Arcane::Exception::_checkExplainAndPause ( )
private

Definition at line 287 of file arccore/src/base/arccore/base/Exception.cc.

◆ _setStackTrace()

void Arcane::Exception::_setStackTrace ( )
private

Definition at line 211 of file arccore/src/base/arccore/base/Exception.cc.

◆ _setWhere()

void Arcane::Exception::_setWhere ( const TraceInfo & where)
private

Definition at line 223 of file arccore/src/base/arccore/base/Exception.cc.

◆ additionalInfo()

const String & Arcane::Exception::additionalInfo ( ) const
inline

Returns the additional information.

Definition at line 118 of file arccore/src/base/arccore/base/Exception.h.

Referenced by Arcane::TimeLoopMng::doComputeLoop().

Here is the caller graph for this function:

◆ explain()

◆ hasPendingException()

bool Arcane::Exception::hasPendingException ( )
static

Indicates if there are pending exceptions.

Definition at line 250 of file arccore/src/base/arccore/base/Exception.cc.

◆ isCollective()

bool Arcane::Exception::isCollective ( ) const
inline

True if it is a collective error (concerns all processors).

Definition at line 109 of file arccore/src/base/arccore/base/Exception.h.

Referenced by Arcane::ArcaneMain::callFunctorWithCatchedException(), Arcane::ArcaneMainExecInfo::initialize(), and Arcane::ExceptionUtils::print().

Here is the caller graph for this function:

◆ message()

const String & Arcane::Exception::message ( ) const
inline

Exception message.

Definition at line 130 of file arccore/src/base/arccore/base/Exception.h.

Referenced by Arcane::CaseOptionException::CaseOptionException(), and Arcane::CaseOptionException::CaseOptionException().

Here is the caller graph for this function:

◆ name()

const String & Arcane::Exception::name ( ) const
inline

Name of the exception.

Definition at line 136 of file arccore/src/base/arccore/base/Exception.h.

Referenced by Arcane::BadPartialVariableItemGroupNameException::explain(), and Arcane::BadVariableKindTypeException::explain().

Here is the caller graph for this function:

◆ setAdditionalInfo()

void Arcane::Exception::setAdditionalInfo ( const String & v)
inline

Sets the additional information.

Definition at line 115 of file arccore/src/base/arccore/base/Exception.h.

◆ setCollective()

void Arcane::Exception::setCollective ( bool v)
inline

Sets the collective state of the expression.

Definition at line 112 of file arccore/src/base/arccore/base/Exception.h.

Referenced by Arcane::CaseOptionException::CaseOptionException(), Arcane::CaseOptionException::CaseOptionException(), Arcane::CaseOptionException::CaseOptionException(), and Arcane::CaseOptionException::CaseOptionException().

Here is the caller graph for this function:

◆ setMessage()

void Arcane::Exception::setMessage ( const String & msg)
inlineprotected

Sets the exception message.

Definition at line 158 of file arccore/src/base/arccore/base/Exception.h.

◆ stackTrace()

const StackTrace & Arcane::Exception::stackTrace ( ) const
inline

Call stack at the moment of the exception (requires a stacktrace service).

Definition at line 121 of file arccore/src/base/arccore/base/Exception.h.

◆ stackTraceString()

const String & Arcane::Exception::stackTraceString ( ) const
inline

Call stack at the moment of the exception (requires a stacktrace service).

Definition at line 124 of file arccore/src/base/arccore/base/Exception.h.

◆ staticInit()

void Arcane::Exception::staticInit ( )
static

Definition at line 260 of file arccore/src/base/arccore/base/Exception.cc.

Referenced by Arcane::ArcaneMain::arcaneInitialize().

Here is the caller graph for this function:

◆ where()

const String & Arcane::Exception::where ( ) const
inline

Location of the exception.

Definition at line 133 of file arccore/src/base/arccore/base/Exception.h.

Referenced by Arcane::BadIDException::BadIDException(), Arcane::BadItemIdException::BadItemIdException(), Arcane::CaseOptionException::CaseOptionException(), Arcane::CaseOptionException::CaseOptionException(), Arcane::CaseOptionException::CaseOptionException(), and Arcane::CaseOptionException::CaseOptionException().

Here is the caller graph for this function:

◆ write()

void Arcane::Exception::write ( std::ostream & o) const
virtual

Definition at line 232 of file arccore/src/base/arccore/base/Exception.cc.

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
const Exception & ex )
friend

Output operator.

Definition at line 277 of file arccore/src/base/arccore/base/Exception.cc.

References Exception(), and operator<<.

Referenced by operator<<.

Member Data Documentation

◆ m_additional_info

String Arcane::Exception::m_additional_info
private

Definition at line 169 of file arccore/src/base/arccore/base/Exception.h.

◆ m_is_collective

bool Arcane::Exception::m_is_collective = false
private

Definition at line 170 of file arccore/src/base/arccore/base/Exception.h.

◆ m_message

String Arcane::Exception::m_message
private

Definition at line 168 of file arccore/src/base/arccore/base/Exception.h.

◆ m_name

String Arcane::Exception::m_name
private

Definition at line 165 of file arccore/src/base/arccore/base/Exception.h.

◆ m_nb_pending_exception

std::atomic< Int32 > Arcane::Exception::m_nb_pending_exception
staticprivate

Definition at line 178 of file arccore/src/base/arccore/base/Exception.h.

◆ m_stack_trace

StackTrace Arcane::Exception::m_stack_trace
private

Definition at line 167 of file arccore/src/base/arccore/base/Exception.h.

◆ m_where

String Arcane::Exception::m_where
private

Definition at line 166 of file arccore/src/base/arccore/base/Exception.h.


The documentation for this class was generated from the following files: