title: Odd behaviour when saving instances in Ruby DataMapper
body: <p>having just started to look at DataMapper for Ruby ORM I've run into an issue that confuses me to no end. </p>
  
  <p>The default behaviour when saving instances in DataMapper (through <strong>DataMapper::Resource.save</strong>) is, as far as I understand, to silently fail, return false from the save method and collect any errors in the errors collection. So far so good, this works as expected. The issue I see is with natural primary keys, where setting duplicate ones will throw an exception instead of silently returning <strong>false</strong> from the save method, blatantly disregarding the current setting of <strong>raise_on_save_failure</strong>. Consider the following snippet;</p>
  
  <pre><code> require 'data_mapper'
  
  class Thing
    include DataMapper::Resource
    property :name , String, :key=&gt;  true
    property :description, String, length: 2..5
  end
  
  DataMapper.setup :default, "sqlite:memory"
  DataMapper.finalize
  DataMapper.auto_migrate!
  
  #Create a thing and have it properly silently fail saving
  t1=Thing.new(:name=&gt;"n1",:description=&gt;"verylongdescription" )
  
  t1.save #ok
  puts("t1 is saved:"+t1.saved?.to_s)
  t1.errors.each do |e|
    puts e
  end
  
  #Create two things with the same key, and fail miserably in silently failing the second     save...
  t1=Thing.new(:name=&gt;"n1",:description=&gt;"ok" )
  t2=Thing.new(:name=&gt;"n1",:description=&gt;"ok" )
  
  t1.save #ok
  t2.save #not ok, raises Exception event though it shouldn't?
  
  puts("t2 is saved:"+t1.saved?.to_s)
  t2.errors.each do |e|
    puts e
  end
  </code></pre>
  
  <p>The first save, on an instance failing a validation rule for the :description property behaves as expected. The third save, of an instance with duplicate keys, however does not, since it raises an execption instead of nicely just returning false. </p>
  
  <p>Why is this? It is obviously possible to work around, but it doesn't feel very clear. Is the case that the silent behaviour will only apply to validation errors in the DataMapper layer, and any hard errors from the underlying datastore will be propagated as exceptions to the caller?</p>
  
  <p>Thanks!</p>