Skip to content

Commit

Permalink
check the lapis code error instead of text message
Browse files Browse the repository at this point in the history
(1) If I18n.locale is not English, then this error message will be
localized, so won't match this condition (for example, for Portuguese
it will be "Este item já existe").

(2) The copy for the error message may change in the future.
  • Loading branch information
vasconsaurus committed Oct 30, 2024
1 parent 2884671 commit cb97946
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/graph/mutations/graphql_crud_operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.safe_save(obj, attrs, parent_names = [])
begin
obj.save_with_version!
rescue RuntimeError => e
if e.message.include?("This item already exists") &&
if e.message.include?("\"code\":9") &&
obj.is_a?(ProjectMedia) &&
obj.set_fact_check.present? &&
obj.set_original_claim.present?
Expand Down

0 comments on commit cb97946

Please sign in to comment.