[Rg 55] Re: Dispatching errors to current controller
Jonathan Buch
john at oxyliquit.de
Mon Jul 16 13:23:24 EDT 2007
Hi,
> The current (0.1.2) behavior for handling errors seems to be to simply
> call /error, but that makes it hard (impossible?) to define different
> error handlers for different controllers. This seems to be hardcoded in
> ramaze/dispatcher/error.rb (lines 7-11):
Good point, I haven't had the need yet to seperate my error pages for
different controllers.
I use the current handling to nicely catch Og errors:
Dispatcher::Error::HANDLE_ERROR[Og::Exception] = [STATUS_CODE['Conflict'],
'/ogerror']
> I'm not sure how hard it would be to change, but I think it would be
> better if it worked along the following lines:
>
> 1. First, check if the current controller has an error action/template
> pair. If that is the case, call the current controller's error action.
>
> 2. If the current controller does not have an error action/template
> pair, call the root controller's error action (/error).
Yes, maybe we can build a two-level lookup there, first using
`Controller.current` and then Controller.get('/') to try and render the
error page. This makes errors even slower than they are right now, but
ah well. :)
HANDLE_ERROR[Og::Exception] = [STATUS_CODE['Conflict'], 'ogerror']
I guess it'd look like that then (without leading slash). Not sure if
I'd be using that feature, but it sounds useful enough for me to go in.
> (And about the different url mappings Jo mentioned earlier today...I've
> never used to second form...I didn't even knew it existed...so I guess I
> don't mind if the second form was dropped... :) )
Great. :P
Jo
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Ramaze-general
mailing list