[ https://issues.apache.org/jira/browse/KAFKA-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14640941#comment-14640941 ]
David Jacot commented on KAFKA-2100: ------------------------------------ I think that UNKNOWN must be kept in the Errors because UNKNOWN (-1) is part of the protocol and used in the code for checking its error code. Yes, exception will get to the log or get to the user. Thinking a bit more about it, would it be better to ensure that same errors are used in both the server and the client by sharing them? It might be already the objective of the common package, isn't it? Then, a warning in the log when a lookup is done might be enough to warn the user that he should check or update his client. Regarding the inconsistent ways, it is not a big deal but I have seen above ways. The first one is used almost everywhere except in the Sender class. {code:title=Coordinator.java|borderStyle=solid} short error = heartbeatResponse.errorCode(); if (error == Errors.NONE.code()) { ... } else { future.raise(new KafkaException("Unexpected error in heartbeat response: " + Errors.forCode(error).exception().getMessage())); } {code} {code:title=Sender.java|borderStyle=solid} Errors error = Errors.forCode(partResp.errorCode); ... if (error != Errors.NONE && canRetry(batch, error)) {code} > Client Error doesn't preserve or display original server error code when it > is an unknown code > ---------------------------------------------------------------------------------------------- > > Key: KAFKA-2100 > URL: https://issues.apache.org/jira/browse/KAFKA-2100 > Project: Kafka > Issue Type: Bug > Components: clients > Reporter: Gwen Shapira > Assignee: David Jacot > Labels: newbie > Attachments: KAFKA-2100-1.patch > > > When the java client receives an unfamiliar error code, it translates it into > UNKNOWN(-1, new UnknownServerException("The server experienced an unexpected > error when processing the request")) > This completely loses the original code, which makes troubleshooting from the > client impossible. > Will be better to preserve the original code and write it to the log when > logging the error. -- This message was sent by Atlassian JIRA (v6.3.4#6332)