Sha256: 821e9f77ed270ef60bc46607e65eb6225e64597594d70b74fac5c55c2bd03756

Contents?: true

Size: 1.74 KB

Versions: 9

Compression:

Stored size: 1.74 KB

Contents

module SpreadsheetArchitect
  module Exceptions

    class OptionTypeError < TypeError
      def initialize(which)
        super("Invalid data type for the #{which} option")
      end
    end

    class ArgumentError < ::ArgumentError
      def initialize(msg)
        super(msg)
      end
    end

    class InvalidRangeError < ArgumentError
      def initialize(type, range)
        case type
        when :columns, :rows
          super("Invalid range `#{range}` passed. Some of the #{type} specified were greater than the total number of #{type}")
        when :format
          super("Invalid range `#{range}` passed. Format must be as follows: A1:D4")
        when :type
          super("Invalid range type `#{range}`. Valid types are String and Hash")
        else
          super("Invalid range `#{range}` passed.")
        end
      end
    end

    class InvalidColumnError < ArgumentError
      def initialize(col)
        super("Invalid Column `#{col}` given for column_types options")
      end
    end

    class InvalidRangeStylesOptionError < ArgumentError
      def initialize(type, opt)
        super("Invalid or missing :#{type} option for `#{opt}`. :#{type} can be an integer, range, or :all")
      end
    end

    class NoDataError < ArgumentError
      def initialize
        super("Missing :data or :instances option")
      end
    end

    class MultipleDataSourcesError < ArgumentError
      def initialize
        super("Both :data and :instances options cannot be combined, please choose one.")
      end
    end
    
    class SpreadsheetColumnsNotDefinedError < ArgumentError
      def initialize(klass, method_name='spreadsheet_columns')
        super("The instance method `#{method_name}` is not defined on #{klass}")
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spreadsheet_architect-4.2.0 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-4.1.0 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-4.0.1 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-4.0.0 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-3.3.1 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-3.3.0 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-3.2.1 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-3.2.0 lib/spreadsheet_architect/exceptions.rb
spreadsheet_architect-3.1.0 lib/spreadsheet_architect/exceptions.rb