aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-26 09:15:43 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-26 09:15:43 -0800
commit28bebb225f567b4c54b2f0ca0a2fc91c2a4d04be (patch)
tree7808eaca7e9a37316a1868f9c35daa3047ee0850 /actionpack
parent62b783e5319f715794b8976f424bfacb85da9c1f (diff)
parent35f38b71dfeacbb4f92a2b1bf4d151c2061700d5 (diff)
downloadrails-28bebb225f567b4c54b2f0ca0a2fc91c2a4d04be.tar.gz
rails-28bebb225f567b4c54b2f0ca0a2fc91c2a4d04be.tar.bz2
rails-28bebb225f567b4c54b2f0ca0a2fc91c2a4d04be.zip
Merge pull request #9434 from zires/dev
Journey::Path::Pattern#new raise more meaningful exception message.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md2
-rw-r--r--actionpack/lib/action_dispatch/journey/path/pattern.rb2
-rw-r--r--actionpack/test/journey/path/pattern_test.rb4
3 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 8ae23598b4..4680e27c9e 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -3,6 +3,8 @@
## Rails 4.0.0.beta1 (February 25, 2013) ##
+* Make ActionDispatch::Journey::Path::Pattern#new raise more meaningful exception message. *Thierry Zires*
+
* Fix `respond_to` not using formats that have no block if all is present. *Michael Grosser*
* New applications use an encrypted session store by default.
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb
index 4a571ec546..d37aa1fbe5 100644
--- a/actionpack/lib/action_dispatch/journey/path/pattern.rb
+++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb
@@ -20,7 +20,7 @@ module ActionDispatch
@separators = strexp.separators.join
@anchored = strexp.anchor
else
- raise "wtf bro: #{strexp}"
+ raise ArgumentError, "Bad expression: #{strexp}"
end
@names = nil
diff --git a/actionpack/test/journey/path/pattern_test.rb b/actionpack/test/journey/path/pattern_test.rb
index 2b7227cd0d..ce02104181 100644
--- a/actionpack/test/journey/path/pattern_test.rb
+++ b/actionpack/test/journey/path/pattern_test.rb
@@ -75,6 +75,10 @@ module ActionDispatch
end
end
+ def test_to_raise_exception_with_bad_expression
+ assert_raise(ArgumentError, "Bad expression: []") { Pattern.new [] }
+ end
+
def test_to_regexp_with_extended_group
strexp = Router::Strexp.new(
'/page/:name',