Browse Source

Allowing details on encode/decode errors

Evan Huus 12 năm trước cách đây
mục cha
commit
fc4945fdf9
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  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
 }