Skip to content

Commit

Permalink
fix(patch): [sc-4693] throw error after catch to ensure correct error…
Browse files Browse the repository at this point in the history
… is thrown
  • Loading branch information
blindspotbounty committed Nov 2, 2023
1 parent 6c05ebc commit ca6bd61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Kafka/RDKafka/RDKafkaClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,11 @@ final class RDKafkaClient: Sendable {
if rd_kafka_error_txn_requires_abort(error) == 1 {
do {
try await self.abortTransaction(attempts: attempts - idx, timeout: timeout)
throw KafkaError.transactionAborted(reason: "Transaction aborted and can be started from scratch")
} catch {
throw KafkaError.transactionIncomplete(
reason: "Could not complete or abort transaction with error \(error)")
}
throw KafkaError.transactionAborted(reason: "Transaction aborted and can be started from scratch")
}
let isFatal = (rd_kafka_error_is_fatal(error) == 1) // fatal when Producer/Consumer must be restarted
throw KafkaError.rdKafkaError(wrapping: rd_kafka_error_code(error), isFatal: isFatal)
Expand Down Expand Up @@ -773,11 +773,11 @@ final class RDKafkaClient: Sendable {
if rd_kafka_error_txn_requires_abort(error) == 1 {
do {
try await self.abortTransaction(attempts: attempts - idx, timeout: timeout)
throw KafkaError.transactionAborted(reason: "Transaction aborted and can be started from scratch")
} catch {
throw KafkaError.transactionIncomplete(
reason: "Could not complete or abort transaction with error \(error)")
}
throw KafkaError.transactionAborted(reason: "Transaction aborted and can be started from scratch")
}
/* check if error is fatal */
let isFatal = (rd_kafka_error_is_fatal(error) == 1) // fatal when Producer/Consumer must be restarted
Expand Down

0 comments on commit ca6bd61

Please sign in to comment.