diff --git a/app/models/project_media.rb b/app/models/project_media.rb index 83b3ca02b..f5b646746 100644 --- a/app/models/project_media.rb +++ b/app/models/project_media.rb @@ -532,12 +532,13 @@ def self.create_tags_in_background(**params) params = params.with_indifferent_access project_media = ProjectMedia.find_by_id(params['project_media_id']) - unless project_media.nil? + if !project_media.nil? tags = JSON.parse(params['tags_json']) tags.each { |tag| Tag.create! annotated: project_media, tag: tag.strip, skip_check_ability: true } + else + error = StandardError.new("[ProjectMedia] Exception creating project media's tags in background. Project media is nil.") + CheckSentry.notify(error, project_media_id: params['project_media_id']) end - error = StandardError.new("[ProjectMedia] Exception creating project media's tags in background. Project media is nil.") - CheckSentry.notify(error) end # private