Module: PublishingPlatformError
- Defined in:
- lib/publishing_platform_app_config/publishing_platform_error.rb,
lib/publishing_platform_app_config/publishing_platform_error/configuration.rb
Defined Under Namespace
Classes: AlreadyInitialised, Configuration
Class Method Summary
collapse
Class Method Details
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/publishing_platform_app_config/publishing_platform_error.rb', line 33
def self.configure
raise PublishingPlatformError::AlreadyInitialised if is_configured?
if defined?(Sidekiq) && !defined?(Sentry::Sidekiq)
warn "Warning: PublishingPlatformError is not configured to track Sidekiq errors, install the sentry-sidekiq gem to track them."
end
Sentry.init do |sentry_config|
config = Configuration.new(sentry_config)
yield config if block_given?
end
end
|
29
30
31
|
# File 'lib/publishing_platform_app_config/publishing_platform_error.rb', line 29
def self.is_configured?
Sentry.get_current_client != nil
end
|
.notify(exception_or_message, args = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/publishing_platform_app_config/publishing_platform_error.rb', line 13
def self.notify(exception_or_message, args = {})
args[:extra] ||= {}
args[:extra].merge!(parameters: args.delete(:parameters))
args[:tags] ||= {}
args[:tags][:publishing_platform_app_config_version] = PublishingPlatformAppConfig::VERSION
if exception_or_message.is_a?(String)
Sentry.capture_message(exception_or_message, **args)
else
Sentry.capture_exception(exception_or_message, **args)
end
end
|