Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Kafka] Update error assertion for MessageTooLargeError #396

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/kafkalib/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import (
)

func isExceedMaxMessageBytesErr(err error) bool {
return err != nil && errors.Is(err, kafka.MessageSizeTooLarge)
var e kafka.MessageTooLargeError
if err != nil && errors.As(err, &e) {
return true
}

return false
}

// isRetryableError - returns true if the error is retryable
Expand Down
2 changes: 1 addition & 1 deletion lib/kafkalib/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestIsExceedMaxMessageBytesErr(t *testing.T) {
expected: false,
},
{
err: kafka.MessageSizeTooLarge,
err: kafka.MessageTooLargeError{},
expected: true,
},
}
Expand Down