Fix Sentry context for security details exception
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user