mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 01:53:40 +08:00
FIX: catch specific exception
This commit is contained in:
parent
9dc96d117f
commit
b573b3227e
|
@ -11,7 +11,7 @@ class IncomingDomain < ActiveRecord::Base
|
|||
|
||||
begin
|
||||
current = create!(name: name, https: https, port: port)
|
||||
rescue
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
# duplicate key is just ignored
|
||||
end
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ class IncomingReferer < ActiveRecord::Base
|
|||
|
||||
begin
|
||||
current = create!(path: path, incoming_domain_id: domain_id)
|
||||
rescue
|
||||
# duplicates
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
# does not matter
|
||||
end
|
||||
|
||||
current || find_by(path: path, incoming_domain_id: domain_id)
|
||||
|
|
Loading…
Reference in New Issue
Block a user