Module: GovukError
- Defined in:
- lib/govuk_app_config/govuk_error.rb,
lib/govuk_app_config/govuk_error/configuration.rb,
lib/govuk_app_config/govuk_error/govuk_data_sync.rb
Defined Under Namespace
Classes: AlreadyInitialised, Configuration, GovukDataSync
Class Method Summary
collapse
Class Method Details
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/govuk_app_config/govuk_error.rb', line 34
def self.configure
raise GovukError::AlreadyInitialised if is_configured?
if defined?(Sidekiq) && !defined?(Sentry::Sidekiq)
warn "Warning: GovukError 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
|
30
31
32
|
# File 'lib/govuk_app_config/govuk_error.rb', line 30
def self.is_configured?
Sentry.get_current_client != nil
end
|
.notify(exception_or_message, args = {}) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/govuk_app_config/govuk_error.rb', line 14
def self.notify(exception_or_message, args = {})
args[:extra] ||= {}
args[:extra].merge!(parameters: args.delete(:parameters))
args[:tags] ||= {}
args[:tags][:govuk_app_config_version] = GovukAppConfig::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
|