Encapsulates State Management error codes for propagating and handling critical functional errors as a C++ exception.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 72647117def3ProvenanceOpen questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Encapsulates State Management error codes for propagating and handling critical functional errors as a C++ exception.
Class ara::sm::SmException serves to propagate exceptional situations that occur during State Management operations [SWS_SM_81242]. It derives from ara::core::Exception and encapsulates a specific ara::core::ErrorCode for exact identification of the error cause that occurred. Its creation is performed via an explicit constructor that is specified as thread-safe and exception safe [SWS_SM_81243]. Calling applications catch the object in a structured manner to analyze the contained error code and initiate corresponding recovery measures.
Context
Class ara::sm::SmException acts as the central exception for the State Management functional cluster in the AUTOSAR Adaptive Platform [SWS_SM_81242]. It is defined in header ara/sm/sm_error_domain.h and derives publicly from the fundamental platform exception class ara::core::ExceptionAUTOSAR_AP_SWS_StateManagement §8.1.4 “Class: SmException”. Within the document, the specification of the class is maintained with status DRAFT [SWS_SM_81242].
In the architectural context, the class links three central roles: State Management as the throwing instance in failing state operations, the calling Adaptive Application as the handler, and the base infrastructure of ara::core, which provides the common interface for error handling. As a carrier of error states, it serves to pass error situations from module sm synchronously via the C++ exception mechanism to higher-level control instances.
Lifecycle
The instantiation of ara::sm::SmException takes place explicitly via the constructor SmException(ara::core::ErrorCode errorCode)[SWS_SM_81243]. This constructor is declared as noexcept and exhibits both the property of exception safety (exception safe) and thread safety (thread-safe) AUTOSAR_AP_SWS_StateManagement §8.1.4.1.1.1 “SmException”. This guarantees that creating the exception object itself neither fails nor throws further exceptions, even when created in concurrent execution contexts.
After creation, the instance is usually thrown by value (by value) and caught in the calling context as a reference to constant objects (const ara::sm::SmException& or polymorphically as const ara::core::Exception&). Since the specification does not prescribe any specific destructors or manual cleanup routines, the destruction of the exception object, according to interpretation, is expected to fully follow standard C++ semantics and the mechanisms of base class ara::core::Exception as soon as the handling block in charge is exited. Question Q-85b1fd2f6082db8e (open)
Usage Path
The typical sequence begins with an application or platform component sending a state control request to State Management. If the requested state change cannot be performed internally or if a severe exception error occurs, State Management instantiates an instance of ara::sm::SmException specifying the corresponding ara::core::ErrorCode[SWS_SM_81243].
Sequence diagram: Typical signaling and handling of an error using SmException in State Management. Sources: [SWS_SM_81242], [SWS_SM_81243].
The calling component catches the thrown exception in a corresponding catch block. Via the methods inherited from base class ara::core::Exception, the application can inspect the encapsulated ara::core::ErrorCode in order to semantically attribute the cause of the error and initiate targeted measures for error remediation or system state recovery.
Error Scenarios
The class ara::sm::SmException does not represent an error-prone operational element itself, but is the primary carrier object for exceptional situations within State Management [SWS_SM_81242]. An essential precondition for creation is the provision of an initialized ara::core::ErrorCode object during the constructor call [SWS_SM_81243].
If a thrown ara::sm::SmException is not caught by any matching handler in the call stack, this leads to a call of std::terminate according to standard C++ rules and thus to an uncontrolled termination of the affected process. In implementations that mandate dispensing with exceptions in favor of ara::core::Result, throwing is avoided; however, if the exception path is available, the encapsulation ensures that the original error code is transported unadulterated for error diagnosis.
This class guide is based on the AUTOSAR Adaptive R25-11 specification. All statements rely on the referenced specification items.
UML class diagram
Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.
gemini-3.8-flash-low· 2026-10-13 · German original