Class: ExceptionHub::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_hub/notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(exception, env) ⇒ Notifier

Returns a new instance of Notifier.



5
6
7
8
# File 'lib/exception_hub/notifier.rb', line 5

def initialize(exception, env)
  @exception = exception
  @env = env
end

Instance Method Details

#notify!Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/exception_hub/notifier.rb', line 10

def notify!
  begin
    issue = Issue.new
    issue.description = build_description
    issue.title = "#{@exception.class.name}: #{@exception.message}"

    issue.send_to_github
  rescue Exception => ex
    ExceptionHub.logger.error("ExceptionHub: #{ex.class.name}: #{ex.message}")
    ExceptionHub.logger.error(ex.backtrace.reduce("") {|memo, line| memo << line << "\n"})
  end
end