DEENESPTFRRUARHIKOZHNL

类 ara::core::Exception

[SWS_CORE_00601] Upstream: RS_AP_00130

class Exception :        public exception {...};

Base type for all ARA exception types

Header-Datei#include "ara/core/exception.h"
Forwarding-Header#include "ara/core/core_fwd.h"
Scopenamespace ara::core
Basisklasse(n)std::exception

用户指南人工智能生成

用作所有 AUTOSAR 异常的基类,并封装线程安全的错误代码以供求值。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: d4eaa8466f70 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用作所有 AUTOSAR 异常的基类,并封装线程安全的错误代码以供求值。

类 ara::core::Exception 用作 Adaptive Platform 所有异常类型的公共基类,并将 ErrorCode 嵌入到标准化的 C++ 异常体系结构中 [SWS_CORE_00611]。当发生错误时,它将该错误代码以线程安全的方式传递给处理程序,处理程序可通过 Error() 或派生的标准方法 what() 对其进行求值 [SWS_CORE_00613]。所有操作均严格具备异常安全性,并声明为 noexcept。为了杜绝派生类型意外发生对象切片(Object Slicing),复制操作被实现为受保护的。

上下文

类 ara::core::Exception 用作 AUTOSAR Adaptive Platform 内所有异常类型的公共基类。它在 C++ 标准库的异常处理与 AUTOSAR 错误模型之间架起了桥梁:一方面,它公开继承自 std::exception 并重写其虚成员函数 what() [SWS_CORE_00612];另一方面,它传递类型为 ara::core::ErrorCode 的内嵌错误对象 [SWS_CORE_00611]、[SWS_CORE_00613]。

ara::core::Exception 的主要职责是在发生异常时跨调用边界结构化地提供错误信息。解读:该类应被设计为平台特定领域异常类的公共根;其复制操作被指定为 protected,以防止派生实例发生意外的对象切片(Object Slicing)[SWS_CORE_00614]、[SWS_CORE_00618]。 问题 Q-20ffec7888b9e724 (未决)

Kontext ara::core::ErrorCode ara::core::ErrorCode ara::core::Exception ara::core::Exception ara::core::ErrorCode->ara::core::Exception eingebettet in std::exception std::exception ara::core::Exception->std::exception erbt von Abgeleitete_Exception Abgeleitete_Exception Abgeleitete_Exception->ara::core::Exception erbt von

上下文图:ara::core::Exception 在 std::exception、封装的 ErrorCode 与派生类之间的嵌入关系。来源:[SWS_CORE_00611]、[SWS_CORE_00612]、[SWS_CORE_00614]、[SWS_CORE_00618]。

生命周期

创建 ara::core::Exception 强制要求在调用构造函数 [SWS_CORE_00611] 时显式指定错误代码。该构造函数定义为 noexcept,因此其自身不会抛出异常。

所有权关系和复制选项遵循严格的保护规则:复制构造函数 [SWS_CORE_00618] 和复制赋值运算符 [SWS_CORE_00614] 均具有访问修饰符 protected。这可以防止多态子类通过基类接口被不完全复制。相比之下,移动构造函数 [SWS_CORE_00615] 和带引用限定符的移动赋值运算符 & [SWS_CORE_00616] 则公开提供为 noexcept=default,用于资源的转移。

销毁通过虚析构函数 [SWS_CORE_00617] 确定性地进行,该析构函数被指定为 noexcept override=default,并确保正确清理派生实例。对方法的并发读取访问以及实例化均表明为线程安全的 [SWS_CORE_00611]、[SWS_CORE_00612]、[SWS_CORE_00613]。

使用路径

常规流程从错误检测、触发异常一直延伸到异常处理程序中的结构化诊断:

  • 创建与触发:组件检测到错误情况,使用匹配的 ErrorCode [SWS_CORE_00611] 实例化 Exception,并通过 throw 抛出该对象。
  • 捕获:上层代码块通过引用捕获该对象(例如作为 const ara::core::Exception& 或多态地作为 const std::exception&)。
  • 标准化文本输出:可通过 what() 获取作为以 null 结尾的字符串的文本说明 [SWS_CORE_00612]。std::exception::what 的所有生命周期保证均在此过程中完全保留。
  • 详细错误检查:处理程序通过成员函数 Error() 访问内嵌 ErrorCode 的常量引用 [SWS_CORE_00613],以便通过机器对系统特定的错误域和代码进行求值。
ara::core::Exception 的实例化与错误查询Fehlerstelleara::core::Exception错误处理Exception(err)throwwhat()const char*Error()const ErrorCode&

时序图:从实例化到错误查询的典型调用顺序。来源:[SWS_CORE_00611]、[SWS_CORE_00612]、[SWS_CORE_00613]。

错误场景

由于 ara::core::Exception 本身即代表错误状态的载体对象,因此所有操作均针对最大容错性而设计:

本指南基于 AUTOSAR Adaptive Platform 规范 Release R25-11。

成员图

构造函数和析构函数

2

方法

2

运算符

1

类图

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__core__Exception792 Exception + Exception() + operator=() + ~Exception() + Error() + what() nstd__exception10 std::exception nara__core__Exception792->nstd__exception10 napext__com__secoc__ComSecOcFvmException158 ComSecOcFvmException napext__com__secoc__ComSecOcFvmException158->nara__core__Exception792 napext__tsync__TsyncFvmException780 TsyncFvmException napext__tsync__TsyncFvmException780->nara__core__Exception792 nara__com__ComException152 ComException nara__com__ComException152->nara__core__Exception792 nara__com__e2e__ComE2EException703 ComE2EException nara__com__e2e__ComE2EException703->nara__core__Exception792 nara__core__CoreException713 CoreException nara__core__CoreException713->nara__core__Exception792 nara__core__FutureException511 FutureException nara__core__FutureException511->nara__core__Exception792 nara__crypto__CryptoException764 CryptoException nara__crypto__CryptoException764->nara__core__Exception792 nara__diag__DiagException942 DiagException nara__diag__DiagException942->nara__core__Exception792 nara__diag__DiagOfferException442 DiagOfferException nara__diag__DiagOfferException442->nara__core__Exception792 nara__diag__DiagReportingException911 DiagReportingException nara__diag__DiagReportingException911->nara__core__Exception792 nara__diag__DiagSovdException335 DiagSovdException nara__diag__DiagSovdException335->nara__core__Exception792 nara__diag__DiagUdsNrcException343 DiagUdsNrcException nara__diag__DiagUdsNrcException343->nara__core__Exception792 nara__exec__ExecException556 ExecException nara__exec__ExecException556->nara__core__Exception792 nara__per__PerException768 PerException nara__per__PerException768->nara__core__Exception792 nara__phm__PhmException101 PhmException nara__phm__PhmException101->nara__core__Exception792 nara__sm__SmException872 SmException nara__sm__SmException872->nara__core__Exception792 nara__tsync__TsyncException184 TsyncException nara__tsync__TsyncException184->nara__core__Exception792

详细视图

请在大纲中选择一个条目。

构造函数和析构函数

Exception 函数 3

Construct a new Exception object with a specific ErrorCode

重载 Exception 3
explicit Exception (ErrorCode err) noexcept; SWS_CORE_00611
Exception (Exception &&other) noexcept=default; SWS_CORE_00615
Exception (const Exception &other) noexcept=default; SWS_CORE_00618
~Exception 函数

Destructor

~Exception () noexcept override=default;

方法

Error 函数

Return the embedded ErrorCode that was given to the constructor

const ErrorCode & Error () const noexcept;
what 函数

Return the explanatory string. This function overrides the virtual function std::exception:: what. All guarantees about the lifetime of the returned pointer that are given for std::exception::what are preserved. ≙ std::exception::

const char * what () const noexcept override;

运算符

operator= 函数 2

Copy assignment operator

重载 = 2
Exception & operator= (const Exception &other) noexcept=default; SWS_CORE_00614
Exception & operator= (Exception &&other) & noexcept=default; SWS_CORE_00616

方法文档

函数 Error [SWS_CORE_00613] Upstream: RS_AP_00130

const ErrorCode & Error () const noexcept;

Return the embedded ErrorCode that was given to the constructor

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
const ErrorCode &reference to the embedded ErrorCode

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

Record
AUTOSAR/AP/record/SWS_CORE_00613
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00613@rel:R25-11#905c6c2a
Content hash
905c6c2a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00613
Status: valid/unmigrated Version: rel:R25-11#768fb30b Versionshistorie & Revisions (1 transition, 8 revision)
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_CORE_00613@rel:R25-11#768fb30b
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#427b88162026-09-30
  • R19-11rel:R19-11#11313e132026-10-14
  • R20-11rel:R20-11#60c96c392026-10-14
  • R21-11rel:R21-11#51ca3dce2026-10-14
  • R22-11rel:R22-11#04096f212026-10-14
  • R23-11rel:R23-11#e6cdb2be2026-10-14
  • R24-11rel:R24-11#538a90522026-10-14
  • R25-11rel:R25-11#768fb30b2026-10-14 active
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

函数 Exception [SWS_CORE_00611] Upstream: RS_AP_00130

explicit Exception (ErrorCode err) noexcept;

Construct a new Exception object with a specific ErrorCode

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
errthe ErrorCode

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

Record
AUTOSAR/AP/record/SWS_CORE_00611
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00611@rel:R25-11#8ff8fdca
Content hash
8ff8fdca
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00611
Status: valid/unmigrated Version: rel:R25-11#4a7f399f Versionshistorie & Revisions (1 transition, 8 revision)
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_CORE_00611@rel:R25-11#4a7f399f
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#eb72a7632026-09-30
  • R19-11rel:R19-11#94d626ce2026-10-14
  • R20-11rel:R20-11#ac6eb9352026-10-14
  • R21-11rel:R21-11#2f59dd412026-10-14
  • R22-11rel:R22-11#211731882026-10-14
  • R23-11rel:R23-11#cf9a6fa22026-10-14
  • R24-11rel:R24-11#d3d5d4b82026-10-14
  • R25-11rel:R25-11#4a7f399f2026-10-14 active
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

函数 Exception [SWS_CORE_00615] Upstream: RS_AP_00130

Exception (Exception &&other) noexcept=default;

Move constructor

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe

Parameter (in)

ParameterBeschreibung
otherthe other instance to move from

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

Record
AUTOSAR/AP/record/SWS_CORE_00615
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00615@rel:R25-11#133d1818
Content hash
133d1818
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00615
Status: valid/unmigrated Version: rel:R25-11#430cfd8b Versionshistorie & Revisions (1 transition, 5 revision)
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_CORE_00615@rel:R25-11#430cfd8b
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#2fbd2fce2026-09-30
  • R22-11rel:R22-11#095dd28c2026-10-14
  • R23-11rel:R23-11#a22844c12026-10-14
  • R24-11rel:R24-11#c20d19892026-10-14
  • R25-11rel:R25-11#430cfd8b2026-10-14 active
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

函数 Exception [SWS_CORE_00618] Upstream: RS_AP_00130

Exception (const Exception &other) noexcept=default;

Copy constructor

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe
Sichtbarkeitprotected

Parameter (in)

ParameterBeschreibung
otherthe other instance
Hinweise: This function has protected access specifier in order to prevent some opportunities for accidental object slicing

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

Record
AUTOSAR/AP/record/SWS_CORE_00618
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00618@rel:R25-11#cf855aae
Content hash
cf855aae
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00618
Status: valid/unmigrated Version: rel:R25-11#96699454 Versionshistorie & Revisions (1 transition, 5 revision)
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_CORE_00618@rel:R25-11#96699454
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#f169ce042026-09-30
  • R22-11rel:R22-11#475a09972026-10-14
  • R23-11rel:R23-11#c7c458632026-10-14
  • R24-11rel:R24-11#03f9f8d22026-10-14
  • R25-11rel:R25-11#966994542026-10-14 active
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

函数 operator= [SWS_CORE_00614] Upstream: RS_AP_00130

Exception & operator= (const Exception &other) noexcept=default;

Copy assignment operator

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe
Sichtbarkeitprotected

Parameter (in)

ParameterBeschreibung
otherthe other instance

Rückgabewert

TypBeschreibung
Exception &*this
Hinweise: This function has protected access specifier in order to prevent some opportunities for accidental object slicing

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

Record
AUTOSAR/AP/record/SWS_CORE_00614
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00614@rel:R25-11#aca73d69
Content hash
aca73d69
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00614
Status: valid/unmigrated Version: rel:R25-11#0a81f511 Versionshistorie & Revisions (1 transition, 7 revision)
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_CORE_00614@rel:R25-11#0a81f511
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#63a7a2e52026-09-30
  • R20-11rel:R20-11#1ef5644f2026-10-14
  • R21-11rel:R21-11#1ef5644f2026-10-14
  • R22-11rel:R22-11#4036011d2026-10-14
  • R23-11rel:R23-11#0996bea22026-10-14
  • R24-11rel:R24-11#ad63d8312026-10-14
  • R25-11rel:R25-11#0a81f5112026-10-14 active
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

函数 operator= [SWS_CORE_00616] Upstream: RS_AP_00130

Exception & operator= (Exception &&other) & noexcept=default;

Move assignment operator

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe

Parameter (in)

ParameterBeschreibung
otherthe other instance to move from

Rückgabewert

TypBeschreibung
Exception &*this

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

Record
AUTOSAR/AP/record/SWS_CORE_00616
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00616@rel:R25-11#66fdb8fb
Content hash
66fdb8fb
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00616
Status: valid/unmigrated Version: rel:R25-11#eb8d2ad7 Versionshistorie & Revisions (1 transition, 5 revision)
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_CORE_00616@rel:R25-11#eb8d2ad7
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#cf7be0402026-09-30
  • R22-11rel:R22-11#62dd53c82026-10-14
  • R23-11rel:R23-11#16771f172026-10-14
  • R24-11rel:R24-11#03c97c992026-10-14
  • R25-11rel:R25-11#eb8d2ad72026-10-14 active
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

函数 what [SWS_CORE_00612] Upstream: RS_AP_00130

const char * what () const noexcept override;

Return the explanatory string. This function overrides the virtual function std::exception:: what. All guarantees about the lifetime of the returned pointer that are given for std::exception::what are preserved.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 1b4e9bb17f9a 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::Exception 的成员函数 what 用于同步检索关于所发生错误的说明性字符串 [SWS_CORE_00612]。它重写虚函数 std::exception::what 并返回指向以空字符终止的字符串(const char*)的指针 [SWS_CORE_00612]。

用法与生命周期

该函数不需要传入参数。关于返回指针的有效性,适用于 std::exception::what 的所有保证均得以保留 [SWS_CORE_00612]。为了使用该函数,必须包含头文件 ara/core/exception.h [SWS_CORE_00612]。

错误处理与并发

  • 异常安全性:该操作被声明为 noexcept 并被指定为异常安全(exception safe);它本身不会引发异常 [SWS_CORE_00612]。
  • 并发性:执行被指定为线程安全(thread-safe)[SWS_CORE_00612]。因此可以从并行线程安全地进行调用。

本使用说明自动生成。

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
const char *a null-terminated string

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

Record
AUTOSAR/AP/record/SWS_CORE_00612
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00612@rel:R25-11#b754dae0
Content hash
b754dae0
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00612
Status: valid/unmigrated Version: rel:R25-11#4dc7ac4e Versionshistorie & Revisions (1 transition, 8 revision)
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_CORE_00612@rel:R25-11#4dc7ac4e
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#b339be862026-09-30
  • R19-11rel:R19-11#c863b8c62026-10-14
  • R20-11rel:R20-11#ef5213282026-10-14
  • R21-11rel:R21-11#ef5213282026-10-14
  • R22-11rel:R22-11#35f8a78d2026-10-14
  • R23-11rel:R23-11#0d1482f32026-10-14
  • R24-11rel:R24-11#260c2d462026-10-14
  • R25-11rel:R25-11#4dc7ac4e2026-10-14 active
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

函数 ~Exception [SWS_CORE_00617] Upstream: RS_AP_00130, RS_AP_00145

~Exception () noexcept override=default;

Destructor

Header-Datei#include "ara/core/exception.h"
Scopeclass ara::core::Exception
Exception-Sicherheitexception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_00617
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00617@rel:R25-11#7c02181c
Content hash
7c02181c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00617
Status: valid/unmigrated Version: rel:R25-11#f3733454 Versionshistorie & Revisions (1 transition, 5 revision)
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_CORE_00617@rel:R25-11#f3733454
Point-in-Time History:
Recorded Revisions (5):
  • R25-11rel:R25-11#6ae22c3b2026-09-30
  • R22-11rel:R22-11#c4c5573b2026-10-14
  • R23-11rel:R23-11#08d2767c2026-10-14
  • R24-11rel:R24-11#8a264f6d2026-10-14
  • R25-11rel:R25-11#f37334542026-10-14 active
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