aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-09-07 20:10:14 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-09-07 20:10:14 +0000
commit9d9ac01c7ddf1d3af1ee2151e2977d3ee9e48294 (patch)
tree1cae6a9050fcfbfbaf934a8c4dbe35a0816fdd90
parent840b5763ffe83ee764aee1e507b731bdc05624fb (diff)
downloadrails-9d9ac01c7ddf1d3af1ee2151e2977d3ee9e48294.tar.gz
rails-9d9ac01c7ddf1d3af1ee2151e2977d3ee9e48294.tar.bz2
rails-9d9ac01c7ddf1d3af1ee2151e2977d3ee9e48294.zip
Add descriptive messages to the exceptions thrown by cgi_methods. Closes #6091.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5066 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/cgi_ext/cgi_methods.rb10
2 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 99005e9a2c..c34b2f2cb4 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Add descriptive messages to the exceptions thrown by cgi_methods. Closes #6091. [Nicholas Seckar]
+
* Update JavaScriptGenerator#show/hide/toggle/remove to new Prototype syntax for multiple ids, #6068 [petermichaux@gmail.com]
* Update UrlWriter to support :only_path. [Nicholas Seckar, Dave Thomas]
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
index 6cb38a38f3..16baa5abda 100755
--- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
+++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
@@ -156,9 +156,9 @@ class CGIMethods #:nodoc:
# Add a container to the stack.
#
def container(key, klass)
- raise TypeError if top.is_a?(Hash) && top.key?(key) && ! top[key].is_a?(klass)
+ type_conflict! klass, top[key] if top.is_a?(Hash) && top.key?(key) && ! top[key].is_a?(klass)
value = bind(key, klass.new)
- raise TypeError unless value.is_a?(klass)
+ type_conflict! klass, value unless value.is_a?(klass)
push(value)
end
@@ -190,5 +190,11 @@ class CGIMethods #:nodoc:
return value
end
+
+ def type_conflict!(klass, value)
+ raise TypeError, "Conflicting types for parameter containers
+ Expected an instance of #{klass}, but found found one of #{value.class}"
+ end
+
end
end \ No newline at end of file