DEENESPTFRRUARHIKOZHNL

类 ara::per::PerErrorDomain

[SWS_PER_00312] Upstream: RS_AP_00122, RS_AP_00127, RS_AP_00140

class PerErrorDomain final :             public ara::core::ErrorDomain {...};

Defines the error domain for Persistency.

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

用户指南人工智能生成

定义持久化模块的错误域,用于提供错误代码、文本描述和异常。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: da81ed3d3cb6 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

定义持久化模块的错误域,用于提供错误代码、文本描述和异常。

类 ara::per::PerErrorDomain 为持久化模块定义错误域,并将错误代码与描述性消息以及异常类型相关联 [SWS_PER_00411]。它通过线程安全的接口实现对域名以及将错误描述解析为具体错误值的查询。需要时,它通过 ThrowAsException() 将错误转换为 C++ 异常 [SWS_PER_00350]。如果在编译器工具链中禁用了异常,则该抛出功能不可用,因此必须完全基于返回值进行错误检查。

上下文

类 ara::per::PerErrorDomain 定义了 AUTOSAR Adaptive Platform 内持久化模块(Persistency)的专用错误域。它继承自基类型定义 ara::core::ErrorDomain 并声明为 final,从而为所有与持久化相关的操作的类型化错误处理和错误映射构成了基础。通过针对底层错误代码枚举 PerErrc 的标准化类型别名 Errc [SWS_PER_00411] 以及针对模块特定异常基类 PerException 的 Exception [SWS_PER_00412],该类将数值错误值、易读的错误消息和具体的 C++ 异常对象关联起来。在平台架构中,该错误域与持久化服务、调用方功能集群以及来自 ara::core 的通用错误与结果结构紧密交互。

生命周期

实例的创建通过标准构造函数 PerErrorDomain() [SWS_PER_00313] 进行。该构造函数声明为 noexcept,完全异常安全(exception safe)且线程安全(thread-safe)。解释:PerErrorDomain 的实例通常应作为长寿命或全局对象进行管理,以确保在整个运行期间对持久化错误进行一致的域比较和类型解析。 问题 Q-5d90982fddec40a7 (未决)由于该类的所有查询操作同样被归类为线程安全,因此多个线程可以并行访问同一个域实例,而无需在调用方级别使用额外的同步机制。

使用路径

典型的使用路径包括识别域、查询易懂的诊断信息,以及在持久化模块中发生错误时可选地抛出异常。首先,成员函数 Name() 以字符串形式返回错误域的唯一标识符 [SWS_PER_00314];它被指定为 noexcept、异常安全且线程安全。如果在持久化操作期间发生错误,则通过 Message() 解析其数值错误值 [SWS_PER_00315]。该方法接收 CodeType 类型的数值错误代码,并作为常量字符指针(const char *)返回相关的错误消息,同样保证完全的异常安全性和线程安全性。

如果要将错误状态转换为 C++ 异常,则使用函数 ThrowAsException() [SWS_PER_00350]。以下流程阐明了错误查询和异常抛出时的相互作用:

PerErrorDomain 中的错误查询与异常抛出应用PersistenzLaufzeitPerErrorDomain执行持久化操作()返回错误代码 / ResultMessage(errorCode)const char * (Fehlernachricht)opt需要异常处理ThrowAsException(errorCode)throw PerException

时序图:通过 PerErrorDomain 进行错误检查、文本查询和异常抛出的典型流程。来源:[SWS_PER_00314]、[SWS_PER_00315]、[SWS_PER_00350]。

错误场景

在实际使用 ara::per::PerErrorDomain 时,开发人员必须考虑有关错误处理和异常安全性的不同保证。虽然查询接口 Name() [SWS_PER_00314] 和 Message() [SWS_PER_00315] 严格声明为 noexcept 并归类为异常安全,但成员函数 ThrowAsException() 被视为非异常安全(not exception safe)[SWS_PER_00350]。这种行为在语义上是有充分理由的,因为该函数的目的在于受控抛出与错误代码相对应的异常(noexcept(false))。

一个关键的约束条件涉及未启用 C++ 异常的平台或构建配置:如果在编译器中禁用了异常处理,则根据 [SWS_PER_00350],ThrowAsException() 不参与重载解析。在这样的环境中,应用软件必须借助于通过提供的别名 Errc [SWS_PER_00411] 和 Message() [SWS_PER_00315] 的文本描述来评估错误代码,而不是捕获 Exception [SWS_PER_00412] 类型的异常对象。

本指南基于 AUTOSAR 规范要求自动生成。

成员图

构造函数和析构函数

1

类型别名

2

类图

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

G nara__per__PerErrorDomain979 PerErrorDomain + PerErrorDomain() + Message() + Name() + ThrowAsException() nara__core__ErrorDomain335 ErrorDomain nara__per__PerErrorDomain979->nara__core__ErrorDomain335

详细视图

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

构造函数和析构函数

Creates a PerErrorDomain instance.

PerErrorDomain () noexcept;

方法

Message 函数

Returns the message associated with the error code.

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

Returns the name of the error domain.

const char * Name () const noexcept override;

Throws the exception associated with the error code. As per [SWS_CORE_10304], this function does not participate in overload resolution when C++ exceptions are disabled in the compiler toolchain.

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

类型别名

Errc 类型别名

Alias for the error code value enumeration.

using Errc = PerErrc;
Exception 类型别名

Alias for the exception base class.

方法文档

函数 Message [SWS_PER_00315] Upstream: RS_AP_00119, RS_AP_00120, RS_AP_00121, RS_AP_00159

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

Returns the message associated with the error code.

Header-Datei#include "ara/per/per_error_domain.h"
Scopeclass ara::per::PerErrorDomain
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
errorCodeThe error code number.

Rückgabewert

TypBeschreibung
const char *The message associated with the error code.

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

Record
AUTOSAR/AP/record/SWS_PER_00315
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00315@rel:R25-11#dbd83be9
Content hash
dbd83be9
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00315
Status: valid/unmigrated Version: rel:R25-11#b3b0e84a 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_PER_00315@rel:R25-11#b3b0e84a
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#dcf865cc2026-09-30
  • R19-11rel:R19-11#fa40c0592026-10-14
  • R20-11rel:R20-11#482223252026-10-14
  • R21-11rel:R21-11#4762f8102026-10-14
  • R22-11rel:R22-11#03cd14022026-10-14
  • R23-11rel:R23-11#d69d63782026-10-14
  • R24-11rel:R24-11#b3b0e84a2026-10-14
  • R25-11rel:R25-11#b3b0e84a2026-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_PER_00314] Upstream: RS_AP_00119, RS_AP_00120, RS_AP_00159

const char * Name () const noexcept override;

Returns the name of the error domain.

Header-Datei#include "ara/per/per_error_domain.h"
Scopeclass ara::per::PerErrorDomain
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Rückgabewert

TypBeschreibung
const char *As per ara::per::PerErrorDomain in [SWS_CORE_90023].

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

Record
AUTOSAR/AP/record/SWS_PER_00314
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00314@rel:R25-11#3e2e5de7
Content hash
3e2e5de7
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00314
Status: valid/unmigrated Version: rel:R25-11#bbc9c834 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_PER_00314@rel:R25-11#bbc9c834
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#8efa8b412026-09-30
  • R19-11rel:R19-11#157f07862026-10-14
  • R20-11rel:R20-11#578706942026-10-14
  • R21-11rel:R21-11#578706942026-10-14
  • R22-11rel:R22-11#7e3ba2a72026-10-14
  • R23-11rel:R23-11#4ed7a81d2026-10-14
  • R24-11rel:R24-11#f4d2bd532026-10-14
  • R25-11rel:R25-11#bbc9c8342026-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

函数 PerErrorDomain [SWS_PER_00313] Upstream: RS_AP_00119, RS_AP_00120, RS_AP_00159

PerErrorDomain () noexcept;

Creates a PerErrorDomain instance.

Header-Datei#include "ara/per/per_error_domain.h"
Scopeclass ara::per::PerErrorDomain
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_PER_00313
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00313@rel:R25-11#eb07023f
Content hash
eb07023f
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00313
Status: valid/unmigrated Version: rel:R25-11#676bd5fe 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_PER_00313@rel:R25-11#676bd5fe
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#2fe03ca62026-09-30
  • R19-11rel:R19-11#493784652026-10-14
  • R20-11rel:R20-11#e90ad4282026-10-14
  • R21-11rel:R21-11#4fed90922026-10-14
  • R22-11rel:R22-11#c86bdbe02026-10-14
  • R23-11rel:R23-11#07bddb402026-10-14
  • R24-11rel:R24-11#676bd5fe2026-10-14
  • R25-11rel:R25-11#676bd5fe2026-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_PER_00350] Upstream: RS_AP_00120, RS_AP_00121

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

Throws the exception associated with the error code. As per [SWS_CORE_10304], this function does not participate in overload resolution when C++ exceptions are disabled in the compiler toolchain.

Header-Datei#include "ara/per/per_error_domain.h"
Scopeclass ara::per::PerErrorDomain
Exception-Sicherheitnot exception safe
Thread-Sicherheitthread-safe

Parameter (in)

ParameterBeschreibung
errorCodeThe error to throw.

Rückgabewert

TypBeschreibung
None

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

Record
AUTOSAR/AP/record/SWS_PER_00350
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00350@rel:R25-11#44adf24d
Content hash
44adf24d
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00350
Status: valid/unmigrated Version: rel:R25-11#d5cad670 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_PER_00350@rel:R25-11#d5cad670
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#ac2c50332026-09-30
  • R19-11rel:R19-11#08d8b5132026-10-14
  • R20-11rel:R20-11#bcef1c2f2026-10-14
  • R21-11rel:R21-11#bcef1c2f2026-10-14
  • R22-11rel:R22-11#855e1f712026-10-14
  • R23-11rel:R23-11#a44240ed2026-10-14
  • R24-11rel:R24-11#d5cad6702026-10-14
  • R25-11rel:R25-11#d5cad6702026-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_PER_00411] Upstream: RS_AP_00122

using Errc = PerErrc;

Alias for the error code value enumeration.

Header-Datei#include "ara/per/per_error_domain.h"
Scopeclass ara::per::PerErrorDomain
SymbolErrc

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

Record
AUTOSAR/AP/record/SWS_PER_00411
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00411@rel:R25-11#3342ae03
Content hash
3342ae03
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00411
Status: valid/unmigrated Version: rel:R25-11#9d0ddf8d 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_PER_00411@rel:R25-11#9d0ddf8d
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#78fe22022026-09-30
  • R20-11rel:R20-11#39e744882026-10-14
  • R21-11rel:R21-11#39e744882026-10-14
  • R22-11rel:R22-11#8f96934a2026-10-14
  • R23-11rel:R23-11#9d0ddf8d2026-10-14
  • R24-11rel:R24-11#9d0ddf8d2026-10-14
  • R25-11rel:R25-11#9d0ddf8d2026-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_PER_00412] Upstream: RS_AP_00122

using Exception = PerException;

Alias for the exception base class.

Header-Datei#include "ara/per/per_error_domain.h"
Scopeclass ara::per::PerErrorDomain
SymbolException

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

Record
AUTOSAR/AP/record/SWS_PER_00412
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_PER_00412@rel:R25-11#502427c2
Content hash
502427c2
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00412
Status: valid/unmigrated Version: rel:R25-11#12539c4d 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_PER_00412@rel:R25-11#12539c4d
Point-in-Time History:
Recorded Revisions (7):
  • R25-11rel:R25-11#0875fcdc2026-09-30
  • R20-11rel:R20-11#e88607572026-10-14
  • R21-11rel:R21-11#e88607572026-10-14
  • R22-11rel:R22-11#b0bd04f32026-10-14
  • R23-11rel:R23-11#12539c4d2026-10-14
  • R24-11rel:R24-11#12539c4d2026-10-14
  • R25-11rel:R25-11#12539c4d2026-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