diff options
author | Szymon Nowak <szimek@gmail.com> | 2012-08-27 23:46:53 +0200 |
---|---|---|
committer | Szymon Nowak <szimek@gmail.com> | 2012-08-27 23:46:53 +0200 |
commit | fd99bb892652b1ffffdd7f9271184235d6040111 (patch) | |
tree | 502f2b63e1c73d6789206dc18a29bbfa7757b5a0 /actionpack/lib | |
parent | b6ba012032c0c53e4539228b06f3da6d6a5a69bc (diff) | |
download | rails-fd99bb892652b1ffffdd7f9271184235d6040111.tar.gz rails-fd99bb892652b1ffffdd7f9271184235d6040111.tar.bz2 rails-fd99bb892652b1ffffdd7f9271184235d6040111.zip |
Make ActionDispatch::ParamsParser::ParseError#original_exception return the original exception.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/params_parser.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 46e33484a4..2c98ca03a8 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -4,7 +4,14 @@ require 'active_support/core_ext/hash/indifferent_access' module ActionDispatch class ParamsParser - class ParseError < StandardError; end + class ParseError < StandardError + attr_reader :original_exception + + def initialize(message, original_exception) + super(message) + @original_exception = original_exception + end + end DEFAULT_PARSERS = { Mime::XML => :xml_simple, @@ -52,10 +59,9 @@ module ActionDispatch false end rescue Exception => e # YAML, XML or Ruby code block errors - message = "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" - logger(env).debug message + logger(env).debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" - raise ParseError, message + raise ParseError.new(e.message, e) end def content_type_from_legacy_post_data_format_header(env) |