[ https://issues.apache.org/jira/browse/KAFKA-14439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17642726#comment-17642726 ]
Jason Gustafson commented on KAFKA-14439: ----------------------------------------- Yeah, we've had so many compatibility breaks due to error code usage. Putting the errors into the spec would also enable better enforcement. One option could be something like this: {code:java} { "name": "ErrorCode", "type": "enum16", "versions": "0+", "about": "The error code,", "values": [ {"value": 0, "versions": "0+", "about": "The operation completed successfully"}, {"value": 1, "versions": "1+", about": "The requested offset was out of range"}, ] } {code} Here "enum16" indicates a 2-byte enumeration where the values are provided in the `values` field. New values can only be added with a version bump. > Specify returned errors for various APIs and versions > ----------------------------------------------------- > > Key: KAFKA-14439 > URL: https://issues.apache.org/jira/browse/KAFKA-14439 > Project: Kafka > Issue Type: Task > Reporter: Justine Olshan > Priority: Major > > Kafka is known for supporting various clients and being compatible across > different versions. But one thing that is a bit unclear is what errors each > response can send. > Knowing what errors can come from each version helps those who implement > clients have a more defined spec for what errors they need to handle. When > new errors are added, it is clearer to the clients that changes need to be > made. > It also helps contributors get a better understanding about how clients are > expected to react and potentially find and prevent gaps like the one found in > https://issues.apache.org/jira/browse/KAFKA-14417 > I briefly synced offline with [~hachikuji] about this and he suggested maybe > adding values for the error codes in the schema definitions of APIs that > specify the error codes and what versions they are returned on. One idea was > creating some enum type to accomplish this. -- This message was sent by Atlassian Jira (v8.20.10#820010)