mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
Proper error handling in Sync class
This commit is contained in:
parent
65e1bc6edd
commit
77a2d6a048
1 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
|||
class Sync < ApplicationRecord
|
||||
Error = Class.new(StandardError)
|
||||
|
||||
belongs_to :syncable, polymorphic: true
|
||||
|
||||
belongs_to :parent, class_name: "Sync", optional: true
|
||||
|
@ -41,7 +43,7 @@ class Sync < ApplicationRecord
|
|||
def handle_child_completion_event
|
||||
unless has_pending_child_syncs?
|
||||
if has_failed_child_syncs?
|
||||
fail!("One or more child syncs failed")
|
||||
fail!(Error.new("One or more child syncs failed"))
|
||||
else
|
||||
complete!
|
||||
syncable.post_sync(self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue