Sha256: 0edc312d8bca69db3bc1a42f8ab1f20ab69f9808b934eb96b52b7b18785dbe4f

Contents?: true

Size: 562 Bytes

Versions: 15

Compression:

Stored size: 562 Bytes

Contents

# frozen_string_literal: true

module ROM
  module SQL
    module Commands
      # Shared error handler for all SQL commands
      #
      # @api private
      module ErrorWrapper
        # Handle Sequel errors and re-raise ROM-specific errors
        #
        # @return [Hash, Array<Hash>]
        #
        # @raise SQL::Error
        #
        # @api public
        def call(*args)
          super
        rescue *ERROR_MAP.keys => e
          raise ERROR_MAP.fetch(e.class, Error), e
        end

        alias_method :[], :call
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rom-sql-3.7.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.6.5 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.6.4 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.6.3 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.6.2 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.6.1 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.6.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-4.0.0.alpha1 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.5.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.4.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.3.3 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.3.2 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.3.1 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.3.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.2.0 lib/rom/sql/commands/error_wrapper.rb