Ver código fonte

Allowing details on encode/decode errors

Evan Huus 12 anos atrás
pai
commit
fc4945fdf9
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      errors.go

+ 4 - 2
errors.go

@@ -64,15 +64,17 @@ func (err OutOfBrokers) Error() string {
 }
 
 type EncodingError struct {
+	msg string
 }
 
 func (err EncodingError) Error() string {
-	return "kafka: Could not encode packet."
+	return "kafka: Could not encode packet. " + err.msg
 }
 
 type DecodingError struct {
+	msg string
 }
 
 func (err DecodingError) Error() string {
-	return "kafka: Could not decode packet. Is the server really speaking kafka?"
+	return "kafka: Could not decode packet. " + err.msg
 }