Sha256: 119248ea55dc0c492c6e156b7515afc32fc99cc280f197cb964df4963e35c871

Contents?: true

Size: 848 Bytes

Versions: 36

Compression:

Stored size: 848 Bytes

Contents

module MongoModel
  class DocumentNotFound < StandardError; end
  
  class DocumentNotSaved < StandardError; end
  
  # Raised by <tt>save!</tt> and <tt>create!</tt> when the document is invalid.  Use the
  # +document+ method to retrieve the document which did not validate.
  #   begin
  #     complex_operation_that_calls_save!_internally
  #   rescue MongoModel::DocumentInvalid => invalid
  #     puts invalid.document.errors
  #   end
  class DocumentInvalid < DocumentNotSaved
    attr_reader :document
    
    def initialize(document)
      @document = document
      
      errors = @document.errors.full_messages.join(I18n.t('support.array.words_connector', :default => ', '))
      super(I18n.t('mongomodel.errors.messages.document_invalid', :errors => errors))
    end
  end
  
  class AssociationTypeMismatch < StandardError; end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
mongomodel-0.4.1 lib/mongomodel/support/exceptions.rb
mongomodel-0.4.0 lib/mongomodel/support/exceptions.rb
mongomodel-0.3.6 lib/mongomodel/support/exceptions.rb
mongomodel-0.3.5 lib/mongomodel/support/exceptions.rb
mongomodel-0.3.4 lib/mongomodel/support/exceptions.rb
mongomodel-0.3.3 lib/mongomodel/support/exceptions.rb
mongomodel-0.3.2 lib/mongomodel/support/exceptions.rb
mongomodel-0.3.1 lib/mongomodel/support/exceptions.rb
mongomodel-0.3.0 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.20 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.19 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.18 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.17 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.16 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.15 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.14 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.13 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.12 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.11 lib/mongomodel/support/exceptions.rb
mongomodel-0.2.10 lib/mongomodel/support/exceptions.rb