Encapsulates error codes of Platform Health Management as a thread-safe exception for failed module operations.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 9c0b25d6fb92ProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Encapsulates error codes of Platform Health Management as a thread-safe exception for failed module operations.
The class ara::phm::PhmException serves in Platform Health Management as the central exception type for encapsulating and propagating module-specific errors to calling components. Upon error detection, it is explicitly instantiated with an ara::core::ErrorCode and thrown to enable structured error handling via corresponding catch blocks [SWS_PHM_01243]. As an essential boundary condition, its construction is specified as noexcept, thread-safe, and exception-safe, ruling out secondary errors during exception creation [SWS_PHM_01243]. Interpretation: Callers typically catch the object by reference in order to evaluate the contained error code deterministically without dynamic memory allocation. Question (open)
Context
The class ara::phm::PhmException acts as a dedicated exception type for Platform Health Management (PHM) within the AUTOSAR Adaptive Platform. According to the class definition, the class derives publicly from ara::core::Exception and provides the link to communicate error states of module phm to calling system and application components via the standardized C++ exception mechanism. In the system architecture, the class primarily interacts between operational PHM services, which perform monitoring functions and detect error states upon rule violations, and the application's higher-level error handling routines. Integration into the fundamental error handling model of ara::core ensures that domain-specific error reports from Platform Health Management can be transported and processed in a standardized manner.
Lifecycle
The lifecycle of an instance of ara::phm::PhmException begins with explicit instantiation in case of error. According to [SWS_PHM_01243], the object is created via constructor PhmException(ara::core::ErrorCode errorCode) including header ara/phm/phm_error_domain.h. Creation is declared as noexcept and exhibits both "exception safe" and "thread-safe" properties [SWS_PHM_01243]. This guarantees that instantiation of the exception object itself occurs safely even under high concurrency and never triggers unexpected secondary exceptions at any time.
The object encapsulates the passed ara::core::ErrorCode and has an immutable state after its creation. During stack unwinding, the exception object is transported through the runtime environment. Destruction occurs deterministically upon exiting the handling catch block according to standard C++ rules. Interpretation: Instances are likely typically created directly in the throw expression on the stack and caught by reference (const ara::phm::PhmException&), so that no dynamic memory allocation is required on the caller side. Question Q-37fc47021a78a0db (open)
Usage Path
The typical usage path begins when a monitored operation of Platform Health Management fails or an invalid state deviation is detected. The triggering PHM function then initializes an exception object with the associated error code and throws it from [SWS_PHM_01243]. On the caller side, the protected code section is executed within a try-catch block. Applications presumably catch the exception either specifically as ara::phm::PhmException or polymorphically via base class ara::core::Exception. Question Q-54638c0dde7d9195 (open) In the exception handler, the contained ara::core::ErrorCode is extracted in order to analyze the cause and initiate appropriate countermeasures or limp-home strategies.
Sequence diagram: Typical sequence from error detection in PHM via throwing ara::phm::PhmException to evaluation in the handler. Sources: [SWS_PHM_01243].
Error Scenarios
A central component of ara::phm::PhmException is transporting the error code at runtime. A precondition for object creation is passing a valid ara::core::ErrorCode[SWS_PHM_01243]. The postcondition of the call is a fully initialized exception object that provides the passed error code unchanged for query.
Since the constructor is explicitly specified as noexcept and "exception safe" [SWS_PHM_01243], the occurrence of exceptions during construction of the exception itself is ruled out. Failure of object creation therefore cannot occur, preventing premature termination via std::terminate during error reporting. The specified thread safety ("thread-safe") also protects against data corruption when multiple threads report error states in parallel via their own exceptions [SWS_PHM_01243]. Consequently, error scenarios do not affect the exception class itself, but reflect the functional error causes encoded in the encapsulated ara::core::ErrorCode of the PHM error domain.
This guide was generated by an AI based on the specification of AUTOSAR Adaptive Platform 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