PowerShell: preserve structured ARM failure details in `ErrorRecord`
メンテナーはふだん 1 日以内に返信
@VeryEarly がすでに取り組んでいます。
2026年10月22日 から。
評価
この issue はまだ評価されていません。
説明
Summary
In the Az 0.1.4 preview bundle, Get-AzResourceGroup reports an ARM 404 through a generic System.Exception, with category NotSpecified and no populated ErrorDetails or TargetObject.
The HTTP status and ARM error code survive in the message text, but callers must parse that text to distinguish service failures reliably.
Reproduction
Using an authenticated profile and a resource-group name that does not exist:
try {
Get-AzResourceGroup `
-SubscriptionId '<subscription-id>' `
-Name 'azclips-ro-check-does-not-exist' `
-ErrorAction Stop
} catch {
[pscustomobject]@{
ExceptionType = $_.Exception.GetType().FullName
ErrorId = $_.FullyQualifiedErrorId
Category = $_.CategoryInfo.Category
ErrorDetails = $_.ErrorDetails
TargetObject = $_.TargetObject
Message = $_.Exception.Message
} | Format-List
}
Observed result
| Field | Observed value |
|---|---|
| Exception type | System.Exception |
| Error ID | ResourceGroupError,Microsoft.Azure.Azclips.Cmdlets.Resources.GetResourceGroupCmdlet |
| Category | NotSpecified |
| ErrorDetails | Null |
| TargetObject | Null |
| Message | HTTP 404, request URL, and embedded ARM JSON containing ResourceGroupNotFound |
-ErrorAction Stop and catch work. The concern is the information available inside the caught record, not whether the error is catchable.
As a control, an unknown cmdlet parameter retains a native ParameterBindingException, category InvalidArgument, and the specific NamedParameterNotFound error ID.
Relevant implementation
The released CmdletOutputStreamsFactory constructs an ErrorRecord using:
new Exception(value?.ToString() ?? string.Empty)
and a null target. This matches the observed generic exception and missing target.
Suggested improvement
Preserve the service failure information in a documented, programmatically accessible form:
- HTTP status and ARM error code.
- A meaningful error category—for example,
ObjectNotFoundfor this case. - The requested resource as
TargetObject. - An underlying exception or structured payload that retains useful service details.
Keep the human-readable message and existing -ErrorAction behavior. The goal is to let scripts handle a missing resource without matching strings inside a message.
Environment and scope
- Release:
v0.1.4.20260930T053744Z - Az rollup 0.1.4; Az.Resources 0.1.2
- PowerShell 7.6.4 on Debian 13
- Read-only request; no resources created or modified
- One ARM 404 case tested; other service-error categories were not tested
- 主要言語
- C#
- スター
- 18
- フォーク
- 10
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 157
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/azclips のほかの issue
-
act-identity-squad bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
act-identity-squad bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
act-identity-squad bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
act-identity-squad bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Azure/azclips#1512 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
act-experience-enablement-squad bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Realm667/WolfenDoom#1758 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
AI documentation good first issue help wanted
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
akshit-bansal11/edgepad#106 ·
メンテナーはふだん 1 日以内に返信