DEENESPTFRRUARHIKOZHNL

class ara::sm::SmException

[SWS_SM_81242] Upstream: RS_AP_00119

class SmException :          public ara::core::Exception {...};

Exception type thrown by State Management.

Header-Datei#include "ara/sm/sm_error_domain.h"
Forwarding-Header#include "ara/sm/sm_fwd.h"
Scopenamespace ara::sm
Basisklasse(n)ara::core::Exception

User GuideAI-GENERATED

Encapsulates State Management error codes for propagating and handling critical functional errors as a C++ exception.
AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 72647117def3 Provenance Open 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::Exception AUTOSAR_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].

Error signaling via SmExceptionApplicationState ManagementSmExceptionExecute state requestFehler identifizieren (ErrorCode)SmException(errorCode)Instanz bereitgestelltthrow SmExceptioncatch (const SmException&) and evaluate error code

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.

G nara__sm__SmException872 SmException + SmException() nara__core__Exception792 Exception nara__sm__SmException872->nara__core__Exception792 nstd__exception10 std::exception nara__core__Exception792->nstd__exception10

Constructors and destructor

SmException function

Construct a new StateManagement exception object containing an error code.

explicit SmException (ara::core::ErrorCode errorCode) noexcept;

Method documentation

function SmException [SWS_SM_81243] Upstream: RS_AP_00119, RS_AP_00159

explicit SmException (ara::core::ErrorCode errorCode) noexcept;

Construct a new StateManagement exception object containing an error code.

Header-Datei#include "ara/sm/sm_error_domain.h"
Scopeclass ara::sm::SmException
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
errorCodeThe error code.

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_SM_81243
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_SM_81243@rel:R25-11#aa947f45
Content hash
aa947f45
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_StateManagement.pdf#nameddest=SWS_SM_81243
Status: valid/unmigrated Version: rel:R25-11#aa947f45 Versionshistorie & Revisions (1 transition)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_SM_81243@rel:R25-11#aa947f45
Point-in-Time History:
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill