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

Base class for an exception. More...

#include <arccore/base/Exception.h>

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.

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]

◆ 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().

◆ ~Exception()

Arcane::Exception::~Exception ( )
override

Releases resources.

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

Member Function Documentation

◆ 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.

◆ 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::ExceptionUtils::print().

◆ message()

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

◆ name()

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

◆ 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()

◆ 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.

◆ where()

◆ 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().


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