RubyFlow The Ruby and Rails community linklog

Catching Invalid JSON Parse Errors with Rack Middleware

The middleware in Rails that parses parameters (ActionDispatch::ParamsParser) runs long before your controller is on the scene, and throws exceptions when invalid JSON is encountered. Fortunately, it’s easy to write custom middleware that rescues the errors thrown when JSON can’t be parsed.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in