Serves as an API exception class for encapsulating and reporting communication management errors via error codes.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: becb2133e102ProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Serves as an API exception class for encapsulating and reporting communication management errors via error codes.
The class ara::com::ComException serves in AUTOSAR Adaptive as the central exception class for signaling errors during calls to the communication API [SWS_CM_11327]. It encapsulates an ara::core::ErrorCode and is instantiated and thrown on failed operations, with its constructor defined as exception-safe and non-throwing [SWS_CM_11328]. If C++ exceptions are disabled in the compiler toolchain, the corresponding throwing API overloads are completely omitted from overload resolution. Callers catch the exception object to analyze the contained error code and initiate error handling actions.
Context
The class ara::com::ComException serves in the com module of the AUTOSAR Adaptive Platform as a specialized exception class for signaling errors during calls to the communication API [SWS_CM_11327]. It publicly derives from the base class ara::core::Exception and is declared as final. This illustrates the direct integration into the overall error handling architecture of the Adaptive Platform. By being marked as final, the class is likely designed as a final exception type that is not intended for a further derivation hierarchy. Question Q-2454b5b73295287b (open)
The primary purpose of ara::com::ComException is to encapsulate an occurred error state in the form of an ara::core::ErrorCode and transmit it to calling layers via the C++ exception mechanism [SWS_CM_11328]. The declaration and definition are provided via header #include "ara/com/com_error_domain.h"[SWS_CM_11328]. The using application software, the internal service and API functions of communication management, and the types of the error domain ara::core::ErrorCode act as the central interaction partners.
Lifecycle
The lifecycle of an ara::com::ComException object begins in the implementation of an API function of communication management as soon as an operation fails and the exception is instantiated and thrown AUTOSAR_AP_SWS_CommunicationManagement §8.12.5 “Class: ComException”. Creation takes place via the explicit constructor, which takes the triggering ara::core::ErrorCode object [SWS_CM_11328].
This constructor is declared with noexcept and has the property exception safe[SWS_CM_11328]. This guarantees that no further exceptions can occur during construction of the exception object itself. After being thrown via throw, the object is transported during stack unwinding until it is bound in a matching catch block of the calling layer. Regarding ownership, the instance is automatically destroyed on the stack after leaving the handling block. The class does not exhibit internal state transitions in the sense of a state machine; its state remains immutable after initialization with the error code.
Usage Path
The typical usage path describes the sequence of error detection, exception throwing, and subsequent handling:
An application function calls an operation of the ara::com interface.
The application catches the exception in a matching block. Catching on the application side is presumably done by const reference (const ara::com::ComException&) to avoid copy operations. Question Q-5270e026eeac8be7 (open)
Via the base class interface, the caller accesses the contained ara::core::ErrorCode and performs diagnostic or compensation steps [SWS_CM_11328].
In the context of error handling and toolchain configuration, the following conditions and corner cases apply:
Disabled C++ exceptions: If C++ exceptions are disabled in the compiler toolchain, API functions that create and throw ara::com::ComException do not participate in overload resolution according to [SWS_CORE_10304]AUTOSAR_AP_SWS_CommunicationManagement §8.12.5 “Class: ComException”. In this case, the error-handling software relies on alternative return mechanisms.
Constructor type safety: Since the constructor is declared as explicit, implicit type conversions when passing the ara::core::ErrorCode are prevented [SWS_CM_11328].
Hierarchical catching: Because ara::com::ComException inherits from ara::core::Exception, callers can handle exceptions either specifically as ara::com::ComException or generally via handlers for the base class.
This guide is based on the AUTOSAR Adaptive R25-11 specification. All statements and references rely exclusively on the provided specification excerpts.
UML class diagram
Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.
gemini-3.8-flash-low· 2026-10-13 · German original