Skip to content

Commit bc8a688

Browse files
authored
feat: require unique error details messages (#1087)
feat: require unique error details messages AIP-193 expresses that for a certain message type, it must be unique in "details" on Status. That is there can be only one message of a certain type as an error detail. Fixes: #1086
1 parent 1c6205c commit bc8a688

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

aip/general/0193.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,18 @@ error message **must** be considered a backwards-incompatible change.
4747
**Note:** The [`ErrorInfo`][ErrorInfo] message is the recommended way to send a
4848
machine-readable identifier.
4949

50+
#### Uniqueness
51+
52+
Each type of detail payload **must** be included at most once. For
53+
example, there **must not** be more than one `ErrorInfo` message in the
54+
`details` field, but there **may** be an `ErrorInfo` and a
55+
[`PreconditionFailure`][PreconditionFailure].
56+
5057
### Localization
5158

5259
Error messages **must** be in English. If a localized error message is also
5360
required, the service **should** use [`google.rpc.LocalizedMessage`][details]
54-
as the `details` field.
61+
in the `details` field.
5562

5663
### Partial errors
5764

@@ -86,6 +93,7 @@ does not exist, the service **must** error with `NOT_FOUND` (HTTP 404).
8693

8794
## Changelog
8895

96+
- **2023-05-04**: Require uniqueness by message type for error details.
8997
- **2022-11-04**: Added guidance around PERMISSION_DENIED errors previously
9098
found in other AIPs.
9199
- **2022-08-12**: Reworded/Simplified intro to add clarity to the intent.
@@ -98,7 +106,8 @@ does not exist, the service **must** error with `NOT_FOUND` (HTTP 404).
98106
<!-- prettier-ignore-start -->
99107
[aip-4221]: ../client-libraries/4221.md
100108
[details]: https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto
101-
[ErrorInfo]: https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto#L51
109+
[ErrorInfo]: https://github.com/googleapis/googleapis/blob/6f3fcc058ff29989f6d3a71557a44b5e81b897bd/google/rpc/error_details.proto#L27-L76
110+
[PreconditionFailure]: https://github.com/googleapis/googleapis/blob/6f3fcc058ff29989f6d3a71557a44b5e81b897bd/google/rpc/error_details.proto#L139-L166
102111
[grpc status code documentation]: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
103112
[Code]: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
104113
[Status]: https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto

0 commit comments

Comments
 (0)