Skip to content

Commit

Permalink
Ignore exceptions when creating nested objects
Browse files Browse the repository at this point in the history
  • Loading branch information
luciajanikova committed Oct 12, 2023
1 parent 8dc5517 commit 8d4fdf9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions app/models/nested_message_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ class NestedMessageObject < ApplicationRecord
def self.create_from_message_object(message_object)
return unless message_object.asice?

nested_message_objects = SignedAttachment::Asice.extract_documents_from_content(message_object.content)
begin
nested_message_objects = SignedAttachment::Asice.extract_documents_from_content(message_object.content)

nested_message_objects.each do |nested_message_object|
message_object.nested_message_objects.create!(
name: nested_message_object.name,
mimetype: nested_message_object.mimetype,
content: nested_message_object.content
)
nested_message_objects.each do |nested_message_object|
message_object.nested_message_objects.create!(
name: nested_message_object.name,
mimetype: nested_message_object.mimetype,
content: nested_message_object.content
)
end
rescue
# noop
end
end
end

0 comments on commit 8d4fdf9

Please sign in to comment.