diff options
author | Szymon Nowak <szimek@gmail.com> | 2012-08-24 18:08:06 +0200 |
---|---|---|
committer | Szymon Nowak <szimek@gmail.com> | 2012-08-24 18:08:06 +0200 |
commit | d14e2e5a217c5dfbc0de1796f2821ea1efd07fe4 (patch) | |
tree | e1c4950a94729ca43b615f56e3c30efde7b4af3d /actionpack/lib/action_dispatch | |
parent | 6a70f2dd6b791c3f4888122d5b7dd9c8f5cac871 (diff) | |
download | rails-d14e2e5a217c5dfbc0de1796f2821ea1efd07fe4.tar.gz rails-d14e2e5a217c5dfbc0de1796f2821ea1efd07fe4.tar.bz2 rails-d14e2e5a217c5dfbc0de1796f2821ea1efd07fe4.zip |
Raise generic ParseError exception when ActionDispatch::ParamsParser fails parsing request params.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/params_parser.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 1cb803ffb9..7f38c6d4f3 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -4,6 +4,8 @@ require 'active_support/core_ext/hash/indifferent_access' module ActionDispatch class ParamsParser + class ParseError < StandardError; end + DEFAULT_PARSERS = { Mime::XML => :xml_simple, Mime::JSON => :json @@ -52,9 +54,10 @@ module ActionDispatch false end rescue Exception => e # YAML, XML or Ruby code block errors - logger(env).debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" + message = "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" + logger(env).debug message - raise e + raise ParseError, message end def content_type_from_legacy_post_data_format_header(env) |