Class: TrackerHub::Request::Utils::Exception

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/tracker_hub/request/utils/exception.rb

Overview

SimpleDelegator wrapping class for exceptions

Instance Method Summary collapse

Instance Method Details

#report(notification, framework = Rails) ⇒ Boolean

Send a report of the exception with a given notification

Examples:

> notifier = TrackerHub::Request::Notification::HipChat.new(token, 'room', 'username')
> notification = TrackerHub::Request::Notification.new(notifier)
> new_exception = Utils::Exception.new(exception)
> new_exception.report(notification)

Parameters:

  • notification (TrackerHub::Request::Notification)

    See in request/notification for a full list of available notifiers

  • framework (undefined) (defaults to: Rails)

    Used framework to retreive the rack environment

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/tracker_hub/request/utils/exception.rb', line 21

def report(notification, framework = Rails)
  formatted_backtrace = backtrace.join("\n")
  msg                 = "[#{framework.env}]\n#{message}\n#{formatted_backtrace}"
  notification.notify(msg)
end