From 5bc8d556dbfb9866b40182f175b421c6d1791eb8 Mon Sep 17 00:00:00 2001 From: Marc Lennox Date: Wed, 11 Feb 2015 09:17:52 -0500 Subject: [PATCH] Addresses issue #282. Modified the client send method to accept both a Raven::Event and an already serialized to_hash event. --- lib/raven/client.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/raven/client.rb b/lib/raven/client.rb index f9da08b18..6817a0460 100644 --- a/lib/raven/client.rb +++ b/lib/raven/client.rb @@ -24,12 +24,15 @@ def initialize(configuration) def send(event) return false unless configuration_allows_sending + # Convert to hash + event = event.to_hash + if !@state.should_try? Raven.logger.error("Not sending event due to previous failure(s): #{get_log_message(event)}") return end - Raven.logger.debug "Sending event #{event.id} to Sentry" + Raven.logger.debug "Sending event #{event['id']} to Sentry" content_type, encoded_data = encode(event) @@ -70,7 +73,7 @@ def encode(event) end def get_log_message(event) - (event && event.message) || '' + (event && event['message']) || '' end def transport