Skip to content

Commit

Permalink
Properly validate topicMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevon committed Jun 29, 2018
1 parent c231143 commit a5a8f12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/producer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ module.exports = ({
* @param {SendBatchRequest}
* @returns {Promise}
*/
const sendBatch = async ({ acks, timeout, compression, topicMessages }) => {
if (topicMessages && topicMessages.length > 0 && topicMessages.some(({ topic }) => !topic)) {
const sendBatch = async ({ acks, timeout, compression, topicMessages = [] }) => {
if (topicMessages.length === 0 || topicMessages.some(({ topic }) => !topic)) {
throw new KafkaJSNonRetriableError(`Invalid topic`)
}

Expand Down

0 comments on commit a5a8f12

Please sign in to comment.