mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-03 20:45:21 +02:00
More exception logging tweaks
This commit is contained in:
parent
29a8ac9d8a
commit
74c7b0941d
1 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
||||||
module Security::Provided
|
module Security::Provided
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
SecurityInfoMissingError = Class.new(StandardError)
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
def provider
|
def provider
|
||||||
registry = Provider::Registry.for_concept(:securities)
|
registry = Provider::Registry.for_concept(:securities)
|
||||||
|
@ -70,9 +72,11 @@ module Security::Provided
|
||||||
logo_url: response.data.logo_url,
|
logo_url: response.data.logo_url,
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
err = StandardError.new("Failed to fetch security info for #{ticker} from #{provider.class.name}: #{response.error.message}")
|
Rails.logger.warn("Failed to fetch security info for #{ticker} from #{provider.class.name}: #{response.error.message}")
|
||||||
Rails.logger.warn(err.message)
|
Sentry.capture_exception(SecurityInfoMissingError.new("Failed to get security info"), level: :warning) do |scope|
|
||||||
Sentry.capture_exception(err, level: :warning)
|
scope.set_tags(security_id: self.id)
|
||||||
|
scope.set_context(provider_error: response.error.message)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue