Skip to content

Commit c7786d8

Browse files
committed
fix: add comment explaining rescue Sequel::ValidationFailed in service broker registration
The around_save hook on the ServiceBroker model catches unique constraint violations and adds errors to the model before raising ValidationFailed. The rescue block returns nil, and callers access errors via the delegated errors method.
1 parent e2f5027 commit c7786d8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/services/service_brokers/service_broker_registration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def create
3131
end
3232
self
3333
rescue Sequel::ValidationFailed
34+
# Errors have been added to the broker model by around_save (e.g. unique constraint violations)
3435
nil
3536
end
3637

@@ -53,6 +54,7 @@ def update
5354
end
5455
self
5556
rescue Sequel::ValidationFailed
57+
# Errors have been added to the broker model by around_save (e.g. unique constraint violations)
5658
nil
5759
end
5860

0 commit comments

Comments
 (0)