Skip to content

Commit

Permalink
fix: make clear that error is configuration issue not server error (#…
Browse files Browse the repository at this point in the history
…2628)

Fixes #1225

Signed-off-by: Mark Hindess <mark.hindess@gmail.com>
  • Loading branch information
hindessm committed Aug 29, 2023
1 parent a4eafb4 commit dedd86d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions async_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,10 @@ func (p *asyncProducer) dispatcher() {
p.returnError(msg, ConfigurationError("Producing headers requires Kafka at least v0.11"))
continue
}
if msg.ByteSize(version) > p.conf.Producer.MaxMessageBytes {
p.returnError(msg, ErrMessageSizeTooLarge)

size := msg.ByteSize(version)
if size > p.conf.Producer.MaxMessageBytes {
p.returnError(msg, ConfigurationError(fmt.Sprintf("Attempt to produce message larger than configured Producer.MaxMessageBytes: %d > %d", size, p.conf.Producer.MaxMessageBytes)))
continue
}

Expand Down

0 comments on commit dedd86d

Please sign in to comment.