Module: Bummer
- Defined in:
- lib/bummer.rb,
lib/bummer/config.rb,
lib/bummer/version.rb
Defined Under Namespace
Modules: Config
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.send_exception(exception) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bummer.rb', line 5 def self.send_exception(exception) Bummer::Config.configure! information = { :version => 1, :application => Bummer::Config.application, :installation => Bummer::Config.installation, :group => exception.class.to_s, :key => exception., :description => exception.backtrace.join("\n"), :created_at => Time.now } server = "http://#{Bummer::Config.host}:#{Bummer::Config.port}/events/log.json" res = nil begin res = Net::HTTP.post_form( URI.parse(server), information ) case res when Net::HTTPCreated puts "[Bummer] Error reported to the vault" else #Net::HTTPOK #Net::HTTPUnauthorized #Net::HTTPInternalServerError puts "[Bummer] An error occurred when reporting the error to the vault '#{res.inspect}'" puts "[Bummer] Exception : '#{exception.inspect}'" end rescue Errno::ECONNREFUSED => e puts "[Bummer] Connection refused to the vault '#{server}'" puts "[Bummer] Exception : '#{exception.inspect}'" end end |