diff --git a/lib/firehose/rack/consumer.rb b/lib/firehose/rack/consumer.rb index d4f5b34..38ada71 100644 --- a/lib/firehose/rack/consumer.rb +++ b/lib/firehose/rack/consumer.rb @@ -78,11 +78,15 @@ def self.post_subscriptions(request) end subs - rescue JSON::ParserError - Firehose.logger.warn "Consumer.post_subscriptions: JSON::ParserError for request body: #{body.inspect}" + rescue JSON::ParserError => e + handle_parse_error(request, body, e) [] end + def self.handle_parse_error(request, body, error) + Firehose.logger.warn "JSON::ParserError for request body: #{body.inspect}" + end + # Let the client configure the consumer on initialization. def initialize yield self if block_given?