lib/app_monit/event.rb in app_monit-0.0.1 vs lib/app_monit/event.rb in app_monit-0.0.2
- old
+ new
@@ -4,15 +4,19 @@
class Event
def self.create(*args)
create!(*args)
rescue Http::Error
false
+ rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,
+ Net::HTTPHeaderSyntaxError, Net::ProtocolError => error
+ raise error unless AppMonit::Config.fail_silent
+ false
end
def self.create!(name, data_hash = {})
created_at = data_hash.delete(:created_at) || Time.now.utc
- message = { created_at: created_at, name: name, payload: data_hash }
+ message = { created_at: created_at, name: name, payload: data_hash }
client.post('/v1/events', message)
end
def self.client
Http