nodece commented on code in PR #1143:
URL: https://github.com/apache/pulsar-client-go/pull/1143#discussion_r1435982667


##########
pulsar/producer_partition.go:
##########
@@ -1019,18 +1026,18 @@ func (p *partitionProducer) SendAsync(ctx 
context.Context, msg *ProducerMessage,
 
 func (p *partitionProducer) validateMsg(msg *ProducerMessage) error {
        if msg == nil {
-               return newError(InvalidMessage, "Message is nil")
+               return joinErrors(ErrInvalidMessage, fmt.Errorf("message is 
nil"))
        }
 
        if msg.Value != nil && msg.Payload != nil {
-               return newError(InvalidMessage, "Can not set Value and Payload 
both")
+               return joinErrors(ErrInvalidMessage, fmt.Errorf("can not set 
Value and Payload both"))
        }
 
        if p.options.DisableMultiSchema {
                if msg.Schema != nil && p.options.Schema != nil &&
                        msg.Schema.GetSchemaInfo().hash() != 
p.options.Schema.GetSchemaInfo().hash() {
                        p.log.Errorf("The producer %s of the topic %s is 
disabled the `MultiSchema`", p.producerName, p.topic)
-                       return fmt.Errorf("msg schema can not match with 
producer schema")
+                       return joinErrors(ErrInvalidMessage, fmt.Errorf("msg 
schema can not match with producer schema"))

Review Comment:
   ```suggestion
                        return joinErrors(ErrSchema, fmt.Errorf("msg schema can 
not match with producer schema"))
   ```
   ErrSchema looks better.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to