Serves as an exception type for reporting core errors and encapsulates an error code for structured exception handling.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2b622ea04d25ProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Serves as an exception type for reporting core errors and encapsulates an error code for structured exception handling.
The class ara::core::CoreException serves as a central exception type for conveying errors from the functional area ara::core and derives from base class Exception for this purpose. Instantiation is mandatory via the constructor by passing a specific ErrorCode that encapsulates the cause of the error [SWS_CORE_05212]. As an essential constraint, the implementation guarantees full thread safety and exception safety as well as an exception-free noexcept guarantee upon creation [SWS_CORE_05212]. Callers catch the exception to handle the contained error state in a controlled manner.
Context
The class ara::core::CoreException serves as a central exception type for errors that occur within the functional area ara::core. According to the class declaration, it publicly derives from base class Exception. The essential task of CoreException is to transfer an occurred error event, described by an ErrorCode object, into the C++ exception handling model. In the platform context, the class thus acts as a bridge between the error-detecting infrastructure component and the calling application or platform code. If an operation in ara::core fails and the interface provides for an exception, CoreException is instantiated and signaled. In doing so, the constructor accepts a concrete object of type [SWS_CORE_05212] according to ErrorCode, which encapsulates the domain-specific cause and domain of the occurred error. Embedding in the class hierarchy allows higher architectural layers to catch errors either specifically as CoreException or to handle them generically via base class Exception.
Context diagram: Relationship of CoreException to ErrorCode and base class Exception. Sources: [SWS_CORE_05212]
Lifecycle
The lifecycle of an instance of CoreException begins in the context of error detection. Creation takes place via the constructor explicit CoreException(ErrorCode err) noexcept according to [SWS_CORE_05212]. The keyword explicit prevents implicit conversion from an ErrorCode, forcing deliberate object creation. An essential characteristic of construction is the specification as noexcept[SWS_CORE_05212]: Instantiation itself cannot throw further exceptions, ensuring reliable exception creation even in critical system states. In addition, exception safety is classified as completely safe (exception safe), and the operation is considered thread-safe (thread-safe) [SWS_CORE_05212]. After creation, the exception object is typically passed on via throw. During stack unwinding, the exception is transported until it is bound by a matching exception handler. The lifecycle ends when exiting the catching block, whereupon the destruction of the exception object is carried out deterministically.
Usage Path
The regular usage path of CoreException is divided into three consecutive phases: diagnosis, throw, and catch. First, a component of module core identifies a deviation from nominal behavior and instantiates a corresponding ErrorCode. The exception is then created by calling constructor CoreException(err)[SWS_CORE_05212]. Immediately thereafter, the object is thrown into the execution context. At user level, the call is executed in a protected block. If the exceptional case occurs, a catch block catches the instance—typically as a const reference to CoreException or polymorphically via base class Exception. In the handler, the error can be analyzed, logged, or remediated. Since header file #include "ara/core/core_error_domain.h" is prescribed according to [SWS_CORE_05212], the class declaration is consistently available for application modules.
Error Scenarios
In the area of error scenarios, CoreException itself serves as a signal carrier and throws no secondary errors during its own creation. Because the constructor is declared as noexcept[SWS_CORE_05212], the scenario of a construction failure is excluded. The specification guarantees strict exception safety and thread safety [SWS_CORE_05212], so that concurrent access during creation also remains safe. A critical error scenario arises at system level when a thrown CoreException is not caught by any higher-level scope, which in standard C++ is expected to lead to a call of std::terminate. Question Q-492683ca01bebc7d (open) Developers must therefore ensure that calls to potentially throwing ara::core functions are embedded in suitable exception handling blocks. A further potential scenario concerns forwarding across component boundaries, where the contained ErrorCode must be interpreted correctly in order to initiate adequate remediation measures.
This guide was generated by an AI curation assistant based on AUTOSAR R25-11.
UML class diagram
Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.
gemini-3.8-flash-low· 2026-10-13 · German original