Skip to content

Instantly share code, notes, and snippets.

View jcuervo's full-sized avatar
💭
I may be slow to respond.

Chard Gonzales jcuervo

💭
I may be slow to respond.
View GitHub Profile
config.middleware.insert_before ActionDispatch::ParamsParser, ::Rack::Robustness do |g|
g.no_catch_all
# you might need to replace this with JSON::ParserError, depending on your Rails configuration
# or you can catch both...
g.on(MultiJson::ParseError) { |ex| 400 }
g.content_type 'text/plain'
g.body{ |ex| ex.message }
g.ensure(true) do |ex|
env['rack.errors'].write(ex.message)
logger.warn(ex.message)