Sha256: 80f69f532e1919128bac0b21aba3ce2d14df48ff50597b50a92cc3402286faca

Contents?: true

Size: 671 Bytes

Versions: 5

Compression:

Stored size: 671 Bytes

Contents

module CleanModel

  class Error < StandardError
  end

  class InvalidTypeAssignment < Error
    def initialize(attribute, value)
      super "#{value} is not valid for #{attribute}"
    end
  end

  class UndefinedPersistenceMethod < Error
    def initialize(klass, method)
      super "#{klass} must define method [#{method}]"
    end
  end

  class InvalidResponse < Error
    def initialize(response)
      super response.content_type == 'application/json' ? response.body : "#{response.code} - Unexpected error"
    end
  end

  class ConnectionFail < Error
    def initialize(exception)
      super exception.message
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
clean_model-0.0.5 lib/clean_model/exceptions.rb
clean_model-0.0.4 lib/clean_model/exceptions.rb
clean_model-0.0.3 lib/clean_model/exceptions.rb
clean_model-0.0.2 lib/clean_model/exceptions.rb
clean_model-0.0.1 lib/clean_model/exceptions.rb