Cyclone ISO C++ API Reference Guide
dds::core::Exception Class Referenceabstract

Exception: base class for specified DDS Exceptions. More...

#include "Exception.hpp"

Inherited by dds::core::AlreadyClosedError, dds::core::Error, dds::core::IllegalOperationError, dds::core::ImmutablePolicyError, dds::core::InconsistentPolicyError, dds::core::InvalidArgumentError, dds::core::InvalidDataError, dds::core::InvalidDowncastError, dds::core::NotEnabledError, dds::core::NullReferenceError, dds::core::OutOfResourcesError, dds::core::PreconditionNotMetError, dds::core::TimeoutError, and dds::core::UnsupportedError.

Public Member Functions

virtual const char * what () const =0 throw ()
 

Detailed Description

Exception: base class for specified DDS Exceptions.

DDS PIM Return Code DDS-PSM-CXX Exception Class std C++ Parent Exception
RETCODE_OK Normal return; no exception N/A
RETCODE_NO_DATA Normal return with informational state attached N/A
RETCODE_ERROR Error std::logic_error
RETCODE_BAD_PARAMETER InvalidArgumentError std::invalid_argument
RETCODE_TIMEOUT TimeoutError std::runtime_error
RETCODE_UNSUPPORTED UnsupportedError std::logic_error
RETCODE_ALREADY_DELETED AlreadyClosedError std::logic_error
RETCODE_ILLEGAL_OPERATION IllegalOperationError std::logic_error
RETCODE_NOT_ENABLED NotEnabledError std::logic_error
RETCODE_PRECONDITION_NOT_MET PreconditionNotMetError std::logic_error
RETCODE_IMMUTABLE_POLICY ImmutablePolicyError std::logic_error
RETCODE_INCONSISTENT_POLICY InconsistentPolicyError std::logic_error
RETCODE_OUT_OF_RESOURCES OutOfResourcesError std::runtime_error

The DDS-PSM-Cxx maps error codes to C++ exceptions defined in the dds::core namespace and inheriting from a base Exception class and the appropriate standard C++ exception. Table 7.3 lists the mapping between error codes as defined in the DDS PIM and C++ exceptions as used in this specification. Exceptions have value semantics; this means that they must always have deep copy semantics. The full list of exceptions is included in the file dds/core/Exceptions.hpp.

Definition at line 64 of file Exception.hpp.

Member Function Documentation

◆ what()

virtual const char* dds::core::Exception::what ( ) const
throw (
)
pure virtual

Retrieve information about the exception that was thrown.

Example

try {
// Do something that will trigger a dds exception, like:
dds::domain::DomainParticipant participant = dds::core::null;
participant.domain_id();
} catch (const dds::core::Exception& e) {
std::cout << e.what() << std::endl;
}

Exception information (of the NullReferenceError in this case)

Null reference: Reference[157] == dds::core::null
========================================================================================
Date : Wed Oct 21 19:28:00 CET 2015
Node : DeLorean
Process : flux_capacitor <15423>
Thread : mr_fusion b6f25700
Internals : ReferenceImpl.hpp/157/V6.6.0
----------------------------------------------------------------------------------------
Report : Null reference: Reference[157] == dds::core::null
Internals : dds::core::Reference<DELEGATE>::delegate/ReferenceImpl.hpp/157
Returns
Exception information

The documentation for this class was generated from the following file:
dds::domain::DomainParticipant::domain_id
uint32_t domain_id() const
dds::core::Reference
Base class for reference-counted objects.
Definition: Reference.hpp:94
dds::core::Exception::what
virtual const char * what() const =0
dds::core::Exception
Exception: base class for specified DDS Exceptions.
Definition: Exception.hpp:64
dds::domain::DomainParticipant
A DomainParticipant represents the local membership of the application in a Domain.
Definition: DomainParticipant.hpp:65