lib/hanami/model/associations/has_many.rb in hanami-model-1.0.4 vs lib/hanami/model/associations/has_many.rb in hanami-model-1.1.0.beta1

- old
+ new

@@ -47,20 +47,22 @@ end # @since 0.7.0 # @api private def create(data) - entity.new( - command(:create, aggregate(target), use: [:timestamps]) - .call(data) - ) + entity.new(command(:create, aggregate(target), use: [:timestamps]) + .call(data)) + rescue => e + raise Hanami::Model::Error.for(e) end # @since 0.7.0 # @api private def add(data) command(:create, relation(target), use: [:timestamps]) .call(associate(data)) + rescue => e + raise Hanami::Model::Error.for(e) end # @since 0.7.0 # @api private def remove(id)