use-standard-error
@azure-tools/typespec-azure-resource-manager/use-standard-errorNon-HEAD operations must define a response marked with @error and use ErrorResponse from ARM common types for marked error payloads.
Use standard ARM operation templates and their default
Azure.ResourceManager.CommonTypes.ErrorResponse error type.
This rule checks all operations except HEAD for at least one response model
marked with TypeSpec’s @error decorator. Every @error response’s payload must
reference the standard Azure.ResourceManager.CommonTypes.ErrorResponse model.
Error bodies must use the standard model directly, including through aliases or
an explicit @body property.
Impact
Section titled “Impact”- Area: API design and generated SDKs
Using one standard error contract gives generated SDKs and Azure tooling a consistent error shape across operations.
Suppression
Section titled “Suppression”Suppress only when required to match an existing API; otherwise use
Azure.ResourceManager.CommonTypes.ErrorResponse for operation
error payloads.
❌ Incorrect
Section titled “❌ Incorrect”@errormodel CustomError { code: string; message: string;}
@armResourceOperationsinterface Widgets { restart is ArmResourceActionAsync<Widget, void, void, Error = CustomError>;}✅ Correct
Section titled “✅ Correct”@armResourceOperationsinterface Widgets { restart is ArmResourceActionAsync<Widget, void, void>;}ArmResourceActionAsync uses the standard ErrorResponse by default.
LintDiff Equivalent
Section titled “LintDiff Equivalent”This rule promotes the LintDiff migration of the Swagger validator rule LroErrorContent.