lib/ears/middlewares/json.rb in ears-0.8.1 vs lib/ears/middlewares/json.rb in ears-0.8.2
- old
+ new
@@ -4,14 +4,14 @@
module Ears
module Middlewares
# A middleware that automatically parses your JSON payload.
class JSON < Middleware
# @param [Hash] opts The options for the middleware.
- # @option opts [Proc] :on_error A Proc to be called when an error occurs during processing
+ # @option opts [Proc] :on_error (Proc.new { :reject }) A Proc to be called when an error occurs during processing.
# @option opts [Boolean] :symbolize_keys (true) Whether to symbolize the keys of your payload.
def initialize(opts = {})
super()
- @on_error = opts.fetch(:on_error)
+ @on_error = opts.fetch(:on_error, Proc.new { :reject })
@symbolize_keys = opts.fetch(:symbolize_keys, true)
end
def call(delivery_info, metadata, payload, app)
begin