no-error-status-codes
@azure-tools/typespec-azure-core/no-error-status-codesAzure REST API guidelines recommend using the default error response for all error cases. Avoid defining custom 4xx or 5xx error status codes individually.
โ Incorrect
Section titled โโ IncorrectโCustom 4xx error status code:
op readWidget(name: string): Widget | { @statusCode statusCode: 404; @body message: "Not Found";};Custom 5xx error status code:
op readWidget(name: string): Widget | { @statusCode statusCode: 503; @body message: "Service Unavailable";};โ Correct
Section titled โโ CorrectโUse default for the error response:
op readWidget(name: string): Widget | { @statusCode statusCode: "default"; @body error: Error;};