Encapsulation of an ErrorDomain. An ErrorDomain is the controlling entity for ErrorCode’s error code values, and defines the mapping of such error code values to textual representations. This type constitutes a base class for ErrorDomain implementations. This class is a literal type, and subclasses are strongly advised to be literal types as well.
Serves as a base class for controlling error codes and maps domain-specific error values to text messages.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: d0712f7c0a23ProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Serves as a base class for controlling error codes and maps domain-specific error values to text messages.
The class ara::core::ErrorDomain serves as an abstract base class for controlling error values and maps domain-specific codes to their textual representations [SWS_CORE_00153]. Subclasses encapsulate a system-wide unique identification number and define the translation into immutable error texts as well as type-specific exception handling. To enable usage as a literal type at compile time, the base class has a non-virtual, protected destructor [SWS_CORE_00136]. Copy and move operations are completely prohibited so that instances act as immutable identities.
Context
The class ara::core::ErrorDomain forms the common foundation for structured error management in the AUTOSAR Adaptive Platform. It acts as an abstract base class for concrete error domains and assumes central control responsibility for error values encapsulated in ara::core::ErrorCode. Each domain spans its own namespace and defines the mapping of domain-specific error values of type CodeType ([SWS_CORE_00122]) to meaningful text representations via Message() ([SWS_CORE_00153]). Furthermore, the class provides the type alias IdType ([SWS_CORE_00121]) for system-wide unique domain identifiers as well as SupportDataType ([SWS_CORE_00123]) for vendor-specific supplementary data.
In the overall system, ara::core::ErrorDomain interacts with three main partners:
Subclasses: Specific error domains inherit from ara::core::ErrorDomain and implement the pure virtual member functions for domain names, error messages, and exception handling.
ara::core::ErrorCode: Represents a concrete error value and delegates the retrieval of the descriptive text to the associated error domain.
Client / application code: Queries status information via the error code or directly on the domain ([SWS_CORE_00152]) or receives thrown C++ exceptions ([SWS_CORE_00154]).
Instantiation of ara::core::ErrorDomain is protected: The constructor has protected visibility and expects a system-wide unique domain identifier of type IdType ([SWS_CORE_00135]). Because the constructor is declared as constexpr and noexcept, the base class supports creation as a literal type at compile time. Subclasses are explicitly recommended to ensure this literal type property as well.
Any duplication or transfer of domain instances is prohibited:
The destructor is declared as protected and defined as a default implementation ([SWS_CORE_00136]). It is deliberately kept trivial and non-virtual so that the class can remain a literal type. Although ara::core::ErrorDomain provides pure virtual interfaces, polymorphic destruction via base class pointers is not required ([SWS_CORE_00136]). In practice, concrete domain instances are likely managed as long-lived or static objects (interpretation). Question Q-a874dd64f6320d21 (open)
Regarding ownership, all pointers to names ([SWS_CORE_00152]) and error texts ([SWS_CORE_00153]) remain in the ownership of the domain class and must not be deallocated by clients. All read and comparison operations are thread-safe and exception-safe ([SWS_CORE_00135], [SWS_CORE_00151]).
Usage Path
Two instances of ara::core::ErrorDomain compare equal if and only if their domain identifiers obtained via Id() ([SWS_CORE_00151]) match ([SWS_CORE_00137], [SWS_CORE_00138]). The typical sequence during error resolution and exception handling is divided into the following steps:
Domain identification: The client or the error object determines the domain name as a null-terminated string via Name() ([SWS_CORE_00152]).
Message resolution: The numeric error value is passed to the domain via Message(errorCode) ([SWS_CORE_00153]). The domain returns a pointer-based, null-terminated error text that is never nullptr.
Exception handling: If an error code is to be transformed into an exception, the client calls ThrowAsException(errorCode) ([SWS_CORE_00154]). The domain then throws an appropriate instance of ara::core::Exception that encapsulates the passed error code.
When working with ara::core::ErrorDomain, the following error scenarios and interface requirements must be taken into account:
Incorrect domain association: If an errorCode that does not originate from this specific ErrorDomain is passed to the method Message(), this constitutes the specified violation WrongDomainOfAn-ErrorCodeViolation ([SWS_CORE_00153]). Callers must ensure that the error code matches the domain instance.
Disabled C++ exceptions: The method ThrowAsException() is not exception-safe (not exception safe) and throws an exception ([SWS_CORE_00154]). If C++ exceptions are disabled in the compiler toolchain, this function must not participate in overload resolution ([SWS_CORE_00154]).
Null pointer exclusion: Neither Name() nor Message() must ever return nullptr ([SWS_CORE_00152], [SWS_CORE_00153]). A subclass implementation returning nullptr violates the interface specification.
This guide was generated by an AI curation assistant based on the AUTOSAR specification R25-11.
Compare for equality with another ara::core::ErrorDomain instance. Two ara::core::ErrorDomain instances compare equal when their identifiers (returned by Id()) are equal
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 59f6b727c495Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The member function Id() of class ara::core::ErrorDomain from the header file ara/core/error_domain.h synchronously returns the unique identifier of the respective error domain ([SWS_CORE_00151]). The call expects no input parameters and returns the domain identifier as a value of type IdType, thereby ensuring unique distinction of different error domains throughout the overall system.
For error handling, it is relevant that the function is declared as noexcept and classified as exception safe ([SWS_CORE_00151]). It therefore never throws exceptions and reports neither error codes nor special cases. Due to the property as a constexpr method, the identifier can already be evaluated at compile time if needed and used in constant expressions.
With respect to concurrency and call conditions, Id() is specified as thread-safe ([SWS_CORE_00151]). The call is stateless and free of modifying side effects, allowing any number of threads to access the same instance simultaneously and without external locking mechanisms.
In interaction within the domain architecture, the identifier forms the primary comparison criterion: According to the specification, two instances of ara::core::ErrorDomain are considered equal if and only if their identifiers returned by Id() match, which is implemented directly by the equality operator operator== ([SWS_CORE_00137]).
This usage note was created by an AI and is based on AUTOSAR Adaptive R25-11.
Return a textual representation of the given errorCode.
The returned pointer remains owned by the ara::core::ErrorDomain sub-class and shall not be freed by clients.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 9827a3eb35a8ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The pure virtual function Message of base class ara::core::ErrorDomain from header ara/core/error_domain.h serves to synchronously retrieve a textual representation for a passed domain-specific error code errorCode[SWS_CORE_00153]. It returns a pointer to a null-terminated string (const char *) that is guaranteed never to be nullptr. The referenced memory remains owned by the respective subclass of ara::core::ErrorDomain and must under no circumstances be freed by calling clients [SWS_CORE_00153].
Regarding concurrency and robustness, the method is declared as noexcept, considered exception safe (exception safe), and designed to be unconditionally thread-safe (thread-safe) [SWS_CORE_00153]. Regarding potential error conditions, it is specified that a errorCode not originating from the respective instance of ara::core::ErrorDomain results in a violation of type WrongDomainOfAnErrorCodeViolation[SWS_CORE_00153].
In interaction with the AUTOSAR error handling model, concrete error domains such as ara::core::FutureErrorDomain[SWS_CORE_00443] and ara::core::CoreErrorDomain[SWS_CORE_05243] override this method to transform domain-specific error codes into concrete message texts. Interpretation: The interaction with ara::core::ErrorCode::Message()[SWS_CORE_00518], which returns a textual representation as StringView, is presumably based on ErrorCode forwarding the translation to method Message of the associated error domain. Question Q-f9007fdf5234b6a4 (open)
This usage note was generated automatically based on the specification requirements.
This function will determine the appropriate exception type for the given ErrorCode according to [SWS_CORE_10953] and throw it. The thrown exception will contain the given ErrorCode.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: f434ab45abb9Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
The pure virtual method ThrowAsException of class ara::core::ErrorDomain serves to synchronously throw a passed error code as an exception of type ara::core::Exception[SWS_CORE_00154]. The function takes a reference to const ErrorCode &errorCode as an input parameter and has no return value, as execution is terminated by throwing the exception [SWS_CORE_00154].
With regard to error and exception behavior, the respective domain determines the exception type matching the passed error code in accordance with [SWS_CORE_10953] and throws it [SWS_CORE_00154]. The thrown exception contains the passed ErrorCode[SWS_CORE_00154]. The function is classified as not exception safe (not exception safe) [SWS_CORE_00154].
The following requirements apply to concurrency and the compiler context:
Thread safety: Calling ThrowAsException is specified as thread-safe (thread-safe) [SWS_CORE_00154].
Restriction when C++ exceptions are disabled: If C++ exceptions are disabled in the compiler toolchain, the function shall not participate in overload resolution according to [SWS_CORE_10304][SWS_CORE_00154].
In interaction with other components, the function forms the basis for throwing exceptions via error objects: thus, ara::core::ErrorCode::ThrowAsException delegates throwing to the associated domain via this->Domain().ThrowAsException(*this)[SWS_CORE_00519]. Concrete implementations override this interface to throw specific exceptions such as CoreException in CoreErrorDomain[SWS_CORE_05244] or FutureException in FutureErrorDomain[SWS_CORE_00444].
This text was created by an AI and is based on the AUTOSAR Adaptive R25-11 specification.
Any exception of the type as defined in [SWS_CORE_10953] containing the given ErrorCode
Hinweise: This function shall not participate in overload resolution when C++ exceptions are disabled in the compiler toolchain. As per [SWS_CORE_10304].
Request a governed re-review of this record. The record is not changed immediately.
This dtor is non-virtual (and trivial) so that this class can be a literal type. While this class has virtual functions, no polymorphic destruction is needed.
gemini-3.8-flash-low· 2026-10-13 · German original