GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Fixed lurking infinite loop with not so common formats and 
ExceptionController

When a controller rendered a somewhat exotic output format (:css, :jpg 
...) and
an exception was raised (non HTTP related, like ArgumentError) an infinite

would be triggered unless the ExceptionController provides that format. 
Which
isn't and shouldn't always be the case. The NotAcceptable exception that 
followed
would be retried/dispatched/rescued over and over.
fabien (author)
Thu Apr 03 13:42:06 -0700 2008
commit  64b6b14d03e6905b1705b0eaf1bb33524fa026e3
tree    cc87c151abe8c007ec0062ae1565ca30ade95a8d
parent  bbbde97f775293238c527df44e0113a37be24e5e
...
9
10
11
12
 
13
14
15
...
146
147
148
149
 
150
151
152
...
9
10
11
 
12
13
14
15
...
146
147
148
 
149
150
151
152
0
@@ -9,7 +9,7 @@ class Mash < Hash
0
   # ==== Alternatives
0
   # If constructor is a Hash, a new mash will be created based on the keys of
0
   # the hash and no default value will be set.
0
- def initialize(constructor = {})
0
+ def initialize(constructor = {})
0
     if constructor.is_a?(Hash)
0
       super()
0
       update(constructor)
0
@@ -146,7 +146,7 @@ class Mash < Hash
0
     when Hash
0
       value.to_mash
0
     when Array
0
- value.collect { |e| e.is_a?(Hash) ? e.to_mash : e }
0
+ value.collect { |e| convert_value(e) }
0
     else
0
       value
0
     end
...
156
157
158
159
 
160
161
 
162
163
164
...
174
175
176
177
 
 
 
178
179
180
...
156
157
158
 
159
160
 
161
162
163
164
...
174
175
176
 
177
178
179
180
181
182
0
@@ -156,9 +156,9 @@ Stacktrace:
0
         request.params[:original_cookies] = request.cookies.dup rescue {}
0
         request.params[:exception] = exception
0
         request.params[:action] = exception_klass.name
0
-
0
+
0
         dispatch_action(klass, exception_klass.name, request, exception.class::STATUS)
0
- rescue => dispatch_issue
0
+ rescue => dispatch_issue
0
         dispatch_issue = controller_exception(dispatch_issue)
0
         # when no action/template exist for an exception, or an
0
         # exception occurs on an InternalServerError the message is
0
@@ -174,7 +174,9 @@ Stacktrace:
0
             retry
0
           else
0
             dispatch_default_exception(klass, request, exception)
0
- end
0
+ end
0
+ elsif request.params[:exception].is_a?(dispatch_issue.class)
0
+ dispatch_default_exception(klass, request, dispatch_issue)
0
         elsif dispatch_issue.is_a?(Merb::ControllerExceptions::InternalServerError)
0
           dispatch_default_exception(klass, request, dispatch_issue)
0
         else

Comments

    No one has commented yet.