فهرست منبع

Allowing details on encode/decode errors

Evan Huus 12 سال پیش
والد
کامیت
fc4945fdf9
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  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
 }