Sha256: a3a67724474284abdd5bb831dbf178107a500847cee3ec0b018fd34dea43cb6d

Contents?: true

Size: 531 Bytes

Versions: 11

Compression:

Stored size: 531 Bytes

Contents

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

11 entries across 11 versions & 1 rubygems

Version Path
rom-sql-3.1.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.0.1 lib/rom/sql/commands/error_wrapper.rb
rom-sql-3.0.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.5.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.4.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.3.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.2.1 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.2.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.1.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.0.0 lib/rom/sql/commands/error_wrapper.rb
rom-sql-2.0.0.rc1 lib/rom/sql/commands/error_wrapper.rb