module GovukError

Public Class Methods

configure() { |config| ... } click to toggle source
# File lib/govuk_app_config/govuk_error.rb, line 34
def self.configure
  raise GovukError::AlreadyInitialised if is_configured?

  Sentry.init do |sentry_config|
    config = Configuration.new(sentry_config)
    yield config if block_given?
  end
end
is_configured?() click to toggle source
# 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 = {}) click to toggle source
# File lib/govuk_app_config/govuk_error.rb, line 14
def self.notify(exception_or_message, args = {})
  # Allow users to use `parameters` as a key like the Airbrake
  # client, allowing easy upgrades.
  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