Skip to content

Commit

Permalink
update how we notify Sentry
Browse files Browse the repository at this point in the history
- call the notify inside else, before I was always sending a sentry error
- it's better to send the project_media_id to Sentry, even if there isn't
a project media object, an id might exist
  • Loading branch information
vasconsaurus committed Sep 12, 2024
1 parent 6d70aaa commit 3cd9a14
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/project_media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3cd9a14

Please sign in to comment.