I benchmarked throw/catch and it is faster than returning error code. However throw does maintain the stack (it prints a stacktrace if it is uncaught - try it in irb), so I'm not sure where the performance hit comes from.
Regardless, hopefully the debate doesn't come down to performance. I did notice what I think is incorrect behavior in create. The create method returns an object, regardless of whether the create failed due to validation. That means you need to do this: model.create(...) if model.errors.length > 0 ... else ... end I tried to delete the cruft from this irb session, but notice the lack of an INSERT on the second create call, but the same return value and the errors array. irb(main):015:0> user = User.create(:email => "[EMAIL PROTECTED]") ~ SELECT "id" FROM "users" WHERE ("email" = '[EMAIL PROTECTED]') ORDER BY "id" LIMIT 1 ~ INSERT INTO "users" ... => #<User id=37 email="[EMAIL PROTECTED]" ... irb(main):016:0> user.errors => #<DataMapper::Validate::ValidationErrors:0x377506c @errors={}> irb(main):017:0> user = User.create(:email => "[EMAIL PROTECTED]") ~ SELECT "id" FROM "users" WHERE ("email" = '[EMAIL PROTECTED]') ORDER BY "id" LIMIT 1 => #<User id=nil email="[EMAIL PROTECTED]" ... irb(main):018:0> user.errors => #<DataMapper::Validate::ValidationErrors:0x3774b6c @errors={:email=> ["Email is already taken"]}> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamapper@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---