This project is archived and is in readonly mode.

#3679 ✓resolved
Nate Wiger

Fix to enable better error message on middleware.insert_before

Reported by Nate Wiger | January 10th, 2010 @ 02:25 AM

Patch against Rails 3.0.pre (edge)

Without the patch, if you try this:

...middleware.insert_before(
  Non::Existent::Middleware,
  My::Middleware
)

You get:

Exiting /Users/nwiger/Workspace/op/proto/fbapp/vendor/gems/dirs/rails/actionpack/lib/action_dispatch/middleware/stack.rb:90:in insert': no implicit conversion from nil to integer (TypeError)

from /Users/nwiger/Workspace/op/proto/fbapp/vendor/gems/dirs/rails/actionpack/lib/action_dispatch/middleware/stack.rb:90:in `insert'

But insert_after already has better handling, so I just adapted that to insert_before. So with the patch, you now get:

Exiting

/Users/nwiger/Workspace/op/proto/fbapp/vendor/gems/dirs/rails/actionpack/lib/action_dispatch/middleware/stack.rb:89:in insert': No such middleware to insert before: Non::Existent::Middleware (RuntimeError)

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages