1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Fix Sentry context for security details exception

This commit is contained in:
Zach Gollwitzer 2025-05-18 10:52:35 -04:00
parent 74c7b0941d
commit f82f77466a
2 changed files with 1 additions and 22 deletions

View file

@ -1,21 +0,0 @@
class FetchSecurityInfoJob < ApplicationJob
queue_as :low_priority
def perform(security_id)
return unless Security.provider.present?
security = Security.find(security_id)
params = {
ticker: security.ticker
}
params[:mic_code] = security.exchange_mic if security.exchange_mic.present?
params[:operating_mic] = security.exchange_operating_mic if security.exchange_operating_mic.present?
security_info_response = Security.provider.fetch_security_info(**params)
security.update(
name: security_info_response.info.dig("name")
)
end
end

View file

@ -75,7 +75,7 @@ module Security::Provided
Rails.logger.warn("Failed to fetch security info for #{ticker} from #{provider.class.name}: #{response.error.message}")
Sentry.capture_exception(SecurityInfoMissingError.new("Failed to get security info"), level: :warning) do |scope|
scope.set_tags(security_id: self.id)
scope.set_context(provider_error: response.error.message)
scope.set_context("security", { id: self.id, provider_error: response.error.message })
end
end
end