Sha256: 5c12d1332f890ce63cf94286109cba44ed7fcc2ecf742ed185fc501416fab4b9

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Esse
  class Error < StandardError
  end

  module Events
    class UnregisteredEventError < ::Esse::Error
      def initialize(object_or_event_id)
        case object_or_event_id
        when String, Symbol
          super("You are trying to publish an unregistered event: `#{object_or_event_id}`")
        else
          super('You are trying to publish an unregistered event')
        end
      end
    end

    class InvalidSubscriberError < ::Esse::Error
      # @api private
      def initialize(object_or_event_id)
        case object_or_event_id
        when String, Symbol
          super("you are trying to subscribe to an event: `#{object_or_event_id}` that has not been registered")
        else
          super('you try use subscriber object that will never be executed')
        end
      end
    end
  end

  module CLI
    class Error < ::Esse::Error
      def initialize(msg = nil, **message_attributes)
        if message_attributes.any?
          msg = format(msg, **message_attributes)
        end
        super(msg)
      end
    end

    class InvalidOption < Error
    end
  end

  # Elasticsearch::Transport::Transport::Errors::NotFound
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
esse-0.2.0 lib/esse/errors.rb
esse-0.1.3 lib/esse/errors.rb
esse-0.1.2 lib/esse/errors.rb
esse-0.1.1 lib/esse/errors.rb