Sha256: e98a7a871abd5229f6fcabae3f528851d90b5b814fc65bb706d725d2c50b34cf

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module HumanAttributes
  module Error
    class NotImplemented < Exception
      def initialize
        super("formatter not implemented")
      end
    end

    class InvalidHumanizeConfig < Exception
      def initialize
        super("humanize options needs to be a Hash")
      end
    end

    class NotEnumerizeAttribute < Exception
      def initialize
        super("needs to be an Enumerize::Value object")
      end
    end

    class MissingFormatterOption < Exception
      def initialize
        super("custom type needs formatter option with a proc")
      end
    end

    class InvalidType < Exception
      def initialize
        types = HumanAttributes::Config::TYPES.map { |t| t[:name] }
        super("type needs to be one of: #{types.join(', ')}")
      end
    end

    class RequiredAttributeType < Exception
      def initialize
        super("type is required")
      end
    end

    class InvalidAttributeOptions < Exception
      def initialize
        super("options needs to be a Hash")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
human_attributes-0.2.0 lib/human_attributes/errors.rb
human_attributes-0.1.1 lib/human_attributes/errors.rb
human_attributes-0.1.0 lib/human_attributes/errors.rb