Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Commit

Permalink
only rescue DB errors (#126)
Browse files Browse the repository at this point in the history
* only rescue DB errors

* change puts to logger
  • Loading branch information
drujensen committed Jan 27, 2018
1 parent 72e165e commit 11e635c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/granite_orm/transactions.cr
Expand Up @@ -32,9 +32,9 @@ module Granite::ORM::Transactions
end
__run_after_save
return true
rescue ex
rescue ex : DB::Error
if message = ex.message
puts "Save Exception: #{message}"
Granite::ORM.settings.logger.error "Save Exception: #{message}"
errors << Granite::ORM::Error.new(:base, message)
end
return false
Expand All @@ -48,9 +48,9 @@ module Granite::ORM::Transactions
@@adapter.delete(@@table_name, @@primary_name, {{primary_name}})
__run_after_destroy
return true
rescue ex
rescue ex : DB::Error
if message = ex.message
puts "Destroy Exception: #{message}"
Granite::ORM.settings.logger.error "Destroy Exception: #{message}"
errors << Granite::ORM::Error.new(:base, message)
end
return false
Expand Down

0 comments on commit 11e635c

Please sign in to comment.