Sha256: 1a3e128dd67bb74e32b9517ad8ee24aaf8a491cdd60153b4b7cf057a7e2f9f4b

Contents?: true

Size: 1.88 KB

Versions: 4

Compression:

Stored size: 1.88 KB

Contents

# frozen_string_literal: true

module WaterDrop
  # Namespace used to encapsulate all the internal errors of WaterDrop
  module Errors
    # Base class for all the WaterDrop internal errors
    BaseError = Class.new(StandardError)

    # Raised when configuration doesn't match with validation contract
    ConfigurationInvalidError = Class.new(BaseError)

    # Raised when we want to use a producer that was not configured
    ProducerNotConfiguredError = Class.new(BaseError)

    # Raised when we want to reconfigure a producer that was already configured
    ProducerAlreadyConfiguredError = Class.new(BaseError)

    # Raised when trying to use connected producer from a forked child process
    # Producers cannot be used in forks if they were already used in the child processes
    ProducerUsedInParentProcess = Class.new(BaseError)

    # Raised when there was an attempt to use a closed producer
    ProducerClosedError = Class.new(BaseError)

    # Raised when we want to send a message that is invalid (impossible topic, etc)
    MessageInvalidError = Class.new(BaseError)

    # Raised when we've got an unexpected status. This should never happen. If it does, please
    # contact us as it is an error.
    StatusInvalidError = Class.new(BaseError)

    # Raised when there is an inline error during single message produce operations
    ProduceError = Class.new(BaseError)

    # Raise it within a transaction to abort it
    AbortTransaction = Class.new(BaseError)

    # Raised when during messages producing something bad happened inline
    class ProduceManyError < ProduceError
      attr_reader :dispatched

      # @param dispatched [Array<Rdkafka::Producer::DeliveryHandle>] handlers of the
      #   messages that we've dispatched
      # @param message [String] error message
      def initialize(dispatched, message)
        super(message)
        @dispatched = dispatched
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
waterdrop-2.6.11 lib/waterdrop/errors.rb
waterdrop-2.6.10 lib/waterdrop/errors.rb
waterdrop-2.6.9 lib/waterdrop/errors.rb
waterdrop-2.6.8 lib/waterdrop/errors.rb