DEENESPTFRRUARHIKOZHNL

类 ara::core::CoreErrorDomain

[SWS_CORE_05221] Upstream: RS_AP_00130

class CoreErrorDomain final :             public ErrorDomain {...};

An error domain for errors originating from the ara::core Functional Cluster.

Header-Datei#include "ara/core/core_error_domain.h"
Forwarding-Header#include "ara/core/core_fwd.h"
Scopenamespace ara::core
Basisklasse(n)ErrorDomain
Unique IDAs per ara::core::CoreErrorDomain in [SWS_CORE_90023]

用户指南人工智能生成

管理 ara::core 功能集群的错误代码,将其转换为错误消息,并抛出相应的异常。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 8500dff6850e 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

管理 ara::core 功能集群的错误代码,将其转换为错误消息,并抛出相应的异常。

类 ara::core::CoreErrorDomain 表示来自功能集群 ara::core 的错误的错误域,并将数字错误代码映射到描述性文本消息 [SWS_CORE_05243]。此外,它还允许通过 ThrowAsException() 将错误代码转换为类型特定的 CoreException 异常 [SWS_CORE_05244]。由于所有查询方法都是线程安全的且可进行 constexpr 构造,因此该域适合在整个集群中高效使用。如果工具链中禁用了 C++ 异常,则该异常方法不参与重载解析。

上下文

类 ara::core::CoreErrorDomain 表示源自功能集群 ara::core 的所有错误状态的特定错误域。它被定义为 ErrorDomain 的 final 特化,从而阻止进一步派生。该类通过方法 Name() 提供域的唯一短名称 [SWS_CORE_05242]。为了与 AUTOSAR 错误处理模型一致集成,CoreErrorDomain 定义了核心类型别名:Errc 作为别名直接引用枚举 CoreErrc [SWS_CORE_05231],而 Exception 构成相应基类异常 CoreException 的别名 [SWS_CORE_05232]。最重要的交互伙伴包括 ErrorCode 类型的通用错误封装(其持有对相应错误域的引用),以及诊断或处理错误状态的执行组件。

生命周期

CoreErrorDomain 的创建通过无参数的默认构造函数 constexpr CoreErrorDomain() noexcept [SWS_CORE_05241] 完成。由于该构造函数被声明为 constexpr 和 noexcept,因此在编译时即可创建实例,而不会产生分配开销或异常风险。

解释:由于 AUTOSAR Adaptive 标准中的错误域被设计为无状态的,并且仅提供常量元数据以及转换逻辑,因此系统中通常可能存在一个全局或静态单例实例,供集群范围内访问。 问题 Q-7b4761bf124c5755 (未决)该实例在进程的整个生命周期内保持有效。在并发性方面,该类的操作被指定为线程安全的 [SWS_CORE_05241]、[SWS_CORE_05242]、[SWS_CORE_05243],从而允许来自多个并行线程的同时查询,而无需额外的同步措施。

使用路径

在正常运行期间,运行时系统或应用程序代码主要在两种典型场景下咨询 CoreErrorDomain:文本错误检查和异常处理。

如果发生错误,可以通过成员函数 Message() 并传入数字错误代码来查询关联的文本消息 [SWS_CORE_05243]。规范严格保证此函数绝不返回空指针(nullptr),因此返回的 const char* 可以安全地用于诊断输出或日志记录。如果错误不作为返回值处理,而是作为 C++ 异常传播,则使用方法 ThrowAsException() [SWS_CORE_05244]。该方法接收一个 ErrorCode 实例,实例化相应的 CoreException 并将其抛入当前调用栈中。

通过 CoreErrorDomain 进行错误文本查询与异常抛出应用CoreErrorDomainCoreExceptionMessage(errorCode)Textmeldung (never nullptr)Use Case: AusnahmebehandlungoptC++ Exceptions aktiviertThrowAsException(errorCode)wirft CoreException(errorCode)

时序图:用于转换错误代码和有条件触发异常的典型流程。来源:[SWS_CORE_05243]、[SWS_CORE_05244]

错误场景

函数 Name() 和 Message() 以及构造函数均被声明为 noexcept 并归类为异常安全的 [SWS_CORE_05241]、[SWS_CORE_05242]、[SWS_CORE_05243]。即使在错误条件下,它们也不会抛出异常,也不会生成自己的错误代码。

相比之下,ThrowAsException() 显式带有 noexcept(false) 标记并被归类为非异常安全,因为确定性地抛出异常(类型为 CoreException)代表了此接口的主要任务 [SWS_CORE_05244]。一个核心的架构前提条件是:如果在所使用的工具链或编译器设置中禁用了 C++ 异常,则此函数不得参与重载解析 [SWS_CORE_05244]。这可以防止在遵循无 C++ 异常处理的容错嵌入式方法的系统环境中出现编译错误。

本指南由 AI 系统基于规范 R25-11 生成。

成员图

构造函数和析构函数

1

类型别名

2

类图

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

G nara__core__CoreErrorDomain113 CoreErrorDomain + CoreErrorDomain() + Message() + Name() + ThrowAsException() nara__core__ErrorDomain335 ErrorDomain nara__core__CoreErrorDomain113->nara__core__ErrorDomain335

详细视图

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

构造函数和析构函数

Default constructor

constexpr CoreErrorDomain () noexcept;

方法

Message 函数

Translate an error code value into a text message

const char * Message (ErrorDomain::CodeType errorCode) const noexcept override;
Name 函数

Return the ApApplicationErrorDomain. shortName of this error domain

const char * Name () const noexcept override;

Throw the exception type corresponding to the given ErrorCode.

void ThrowAsException (const ErrorCode &errorCode) const noexcept(false) override;

类型别名

Errc 类型别名

Alias for the error code value enumeration

using Errc = CoreErrc;
Exception 类型别名

Alias for the exception base class

方法文档

函数 CoreErrorDomain [SWS_CORE_05241] Upstream: RS_AP_00130

constexpr CoreErrorDomain () noexcept;

Default constructor

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

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

Record
AUTOSAR/AP/record/SWS_CORE_05241
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_05241@rel:R25-11#e0e839f4
Content hash
e0e839f4
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_05241
Status: valid/unmigrated Version: rel:R25-11#3e485a80 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_05241@rel:R25-11#3e485a80
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#b295a3ea2026-09-30
  • R19-11rel:R19-11#070db4fd2026-10-14
  • R20-11rel:R20-11#fbd86c322026-10-14
  • R21-11rel:R21-11#f39944522026-10-14
  • R22-11rel:R22-11#326fb7c62026-10-14
  • R23-11rel:R23-11#5f0eb25d2026-10-14
  • R24-11rel:R24-11#3e485a802026-10-14
  • R25-11rel:R25-11#3e485a802026-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

函数 Message [SWS_CORE_05243] Upstream: RS_AP_00130

const char * Message (ErrorDomain::CodeType errorCode) const noexcept override;

Translate an error code value into a text message

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

Parameter (in)

ParameterBeschreibung
errorCodethe error code value

Rückgabewert

TypBeschreibung
const char *the text message, never nullptr

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

Record
AUTOSAR/AP/record/SWS_CORE_05243
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_05243@rel:R25-11#4bbf0527
Content hash
4bbf0527
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_05243
Status: valid/unmigrated Version: rel:R25-11#00427b91 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_05243@rel:R25-11#00427b91
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#09cacd332026-09-30
  • R19-11rel:R19-11#d12bc2432026-10-14
  • R20-11rel:R20-11#2b2da89e2026-10-14
  • R21-11rel:R21-11#2b2da89e2026-10-14
  • R22-11rel:R22-11#73527d722026-10-14
  • R23-11rel:R23-11#17fa2fc82026-10-14
  • R24-11rel:R24-11#00427b912026-10-14
  • R25-11rel:R25-11#00427b912026-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

函数 Name [SWS_CORE_05242] Upstream: RS_AP_00130

const char * Name () const noexcept override;

Return the ApApplicationErrorDomain. shortName of this error domain

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

Rückgabewert

TypBeschreibung
const char *As per ara::core::CoreErrorDomain in [SWS_CORE_90023]

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

Record
AUTOSAR/AP/record/SWS_CORE_05242
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_05242@rel:R25-11#20371be0
Content hash
20371be0
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_05242
Status: valid/unmigrated Version: rel:R25-11#1f57e0cc 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_05242@rel:R25-11#1f57e0cc
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#d99ba5832026-09-30
  • R19-11rel:R19-11#5d1f96f42026-10-14
  • R20-11rel:R20-11#4467617d2026-10-14
  • R21-11rel:R21-11#4467617d2026-10-14
  • R22-11rel:R22-11#11fc29042026-10-14
  • R23-11rel:R23-11#a9c4ef8a2026-10-14
  • R24-11rel:R24-11#347b7dd02026-10-14
  • R25-11rel:R25-11#1f57e0cc2026-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

函数 ThrowAsException [SWS_CORE_05244] Upstream: RS_AP_00130

void ThrowAsException (const ErrorCode &errorCode) const noexcept(false) override;

Throw the exception type corresponding to the given ErrorCode.

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

类 ara::core::CoreErrorDomain 的成员函数 ThrowAsException(在头文件 ara/core/core_error_domain.h 中定义)用于基于传入的错误码 [SWS_CORE_05244] 同步引发 C++ 异常。该函数接受一个对 ErrorCode 常量实例的引用作为参数 (const ErrorCode &errorCode) [SWS_CORE_05244]。该方法没有返回值,而是直接抛出一个类型为 CoreException 的异常,该异常完全封装了传入的 ErrorCode 对象 [SWS_CORE_05244]。

关于执行上下文、并发性和编译器条件,适用以下规范:

  • 线程安全性:该函数被指定为线程安全 (thread-safe),因此可以安全地从并发上下文调用 [SWS_CORE_05244]。
  • 异常安全性:该行为形式上被归类为非异常安全 (not exception safe),因为该函数使用 noexcept(false) 声明,并按预期抛出异常 [SWS_CORE_05244]。
  • 编译器限制:如果在编译器工具链中禁用了 C++ 异常,则根据 [SWS_CORE_10304],该方法不得参与重载解析 [SWS_CORE_05244]。

在架构体系中,该方法重写 (override) 了抽象类 ara::core::ErrorDomain 的纯虚基函数 ThrowAsException [SWS_CORE_00154]。在典型应用中,该函数不是直接在域对象上调用,而是通过辅助方法 ErrorCode::ThrowAsException() 触发,该辅助方法通过 this->Domain().ThrowAsException(*this) 将调用动态转发至负责的错误域 [SWS_CORE_00519]。

本使用说明由 AI 基于 AUTOSAR Adaptive R25-11 规范生成。

实现者指南即将推出(复杂度 I1)

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

Parameter (in)

ParameterBeschreibung
errorCodethe ErrorCode instance

Rückgabewert

TypBeschreibung
None

Exceptions

CoreException an exception containing the given ErrorCode

Hinweise: This function shall not participate in overload resolution when C++ exceptions are disabled in the compiler toolchain. As per [SWS_CORE_10304]

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

Record
AUTOSAR/AP/record/SWS_CORE_05244
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_05244@rel:R25-11#e5325ada
Content hash
e5325ada
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_05244
Status: valid/unmigrated Version: rel:R25-11#76549789 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_05244@rel:R25-11#76549789
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#8be3b2f52026-09-30
  • R19-11rel:R19-11#98ba1eda2026-10-14
  • R20-11rel:R20-11#1103982a2026-10-14
  • R21-11rel:R21-11#52e0dd5c2026-10-14
  • R22-11rel:R22-11#5de8a1b22026-10-14
  • R23-11rel:R23-11#27770af82026-10-14
  • R24-11rel:R24-11#0c81b1e92026-10-14
  • R25-11rel:R25-11#765497892026-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

类型别名文档

类型别名 Errc [SWS_CORE_05231] Upstream: RS_AP_00130

using Errc = CoreErrc;

Alias for the error code value enumeration

Header-Datei#include "ara/core/core_error_domain.h"
Scopeclass ara::core::CoreErrorDomain
SymbolErrc

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

Record
AUTOSAR/AP/record/SWS_CORE_05231
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_05231@rel:R25-11#956614dd
Content hash
956614dd
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_05231
Status: valid/unmigrated Version: rel:R25-11#c33560a7 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_05231@rel:R25-11#c33560a7
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#634f14922026-09-30
  • R19-11rel:R19-11#37c73a1f2026-10-14
  • R20-11rel:R20-11#a73623902026-10-14
  • R21-11rel:R21-11#a73623902026-10-14
  • R22-11rel:R22-11#5b6e63892026-10-14
  • R23-11rel:R23-11#f478ff612026-10-14
  • R24-11rel:R24-11#c33560a72026-10-14
  • R25-11rel:R25-11#c33560a72026-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_05232] Upstream: RS_AP_00130

using Exception = CoreException;

Alias for the exception base class

Header-Datei#include "ara/core/core_error_domain.h"
Scopeclass ara::core::CoreErrorDomain
SymbolException

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

Record
AUTOSAR/AP/record/SWS_CORE_05232
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_05232@rel:R25-11#aa1814ab
Content hash
aa1814ab
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_05232
Status: valid/unmigrated Version: rel:R25-11#5d1bfae3 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_05232@rel:R25-11#5d1bfae3
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#9c108ed52026-09-30
  • R19-11rel:R19-11#d33d63502026-10-14
  • R20-11rel:R20-11#907e01392026-10-14
  • R21-11rel:R21-11#907e01392026-10-14
  • R22-11rel:R22-11#3eaa58ca2026-10-14
  • R23-11rel:R23-11#bdda71cf2026-10-14
  • R24-11rel:R24-11#5d1bfae32026-10-14
  • R25-11rel:R25-11#5d1bfae32026-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