[
https://issues.apache.org/jira/browse/KAFKA-7787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17074447#comment-17074447
]
Tom Bentley commented on KAFKA-7787:
------------------------------------
[~cmccabe] any more thoughts about this (did you notice I opened a PR in case
you wanted to take a look?)
{quote}In the case of Errors, we need to associate each enum with a
corresponding exception. I guess we could have a helper class for this.
{quote}
Can you elaborate on what you're envisaging there? I played around with
generating functions for mapping between codes and enum elements, via a
"enumClass" key in the codes declaration:
{code}
{
"type": "codes",
"name": "ErrorCodes",
"valueType": "int16",
"enumClass": "org.apache.kafka.common.protocol.Errors",
"codes": [
{ "name": "UNKNOWN_SERVER_ERROR", "value": -1,
"about": "The server experienced an unexpected error when processing the
request." },
{ "name": "NONE", "value": 0,
"about": "No error." },
{code}
Obviously for error codes we can use {{Errors}} and from that obtain the
exception class, but that might also be useful for the other code enums.
The other thing I'm struggling with a bit is how we can correctly specify the
valid versions for each error code at the use site, e.g.
{code}
{
"name": "ErrorCode",
"type": "int16",
"domain": {
"name": "ErrorCodes",
"values": [
{ "name": "NONE", "validVersions": "0+" },
{ "name": "FOO", "validVersions": "0+" },
{ "name": "BAR", "validVersions": "3+" },
...
]
}
}
{code}
Determining correctly what error codes can propagate from a given RPC is
difficult enough even for the _current version_ of an API.
Do you have any ideas for a testing methodology?
> Add error specifications to KAFKA-7609
> --------------------------------------
>
> Key: KAFKA-7787
> URL: https://issues.apache.org/jira/browse/KAFKA-7787
> Project: Kafka
> Issue Type: Sub-task
> Reporter: Colin McCabe
> Assignee: Tom Bentley
> Priority: Minor
>
> In our RPC JSON, it would be nice if we could specify what versions of a
> response could contain what errors. See the discussion here:
> https://github.com/apache/kafka/pull/5893#discussion_r244841051
--
This message was sent by Atlassian Jira
(v8.3.4#803005)