Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-10830

Kafka Producer API should throw unwrapped exceptions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • producer
    • None

    Description

      Today in various KafkaProducer APIs (especially send and transaction related) we wrap many of the underlying exception with a KafkaException. In some nested calls we may even wrap it more than once. Although the initial goal is to not expose the root cause directly to users, it also brings confusion to advanced user's error handling that some KafkaException wrapped root cause may be handled differently.

      Since all of those exceptions are public classes anyways (since one can still get them via exception.root()) and they are all inheriting KafkaException, I'd suggest we do not do any wrapping any more and throw the exception directly. For those users who just capture all KafkaException and handle them universally it is still compatible; but for those users who want to handle exceptions differently it would introduce an easier way.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              guozhang Guozhang Wang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: