[Rg 58] Re: Dispatching errors to current controller
Lars Olsson
lasso at lassoweb.se
Thu Jul 19 16:38:50 EDT 2007
Michael Fellinger skrev:
> The controller was never turned into a real action and rendered, where
> assignment of Action.current.controller happens which
> Controller.current points to.
> However, i took your idea and turned it into code, it has some more
> features but maintains the old functionality as well. Just pull darcs
> to get it :)
> Thanks for the idea though, this is a much nicer way to handle errors
> per controller.
>
> ^ manveru
Works great. Thanks for adding this!
Another improvement might be to cut down on the number of errors emitted
to Informer in the case of a missing action/controller. For a simple
Ramaze::Error::NoAction I get quite much info emitted to the console:
[2007-07-19 22:23:37] ERROR #<Ramaze::Error::NoAction: No Action found
for `/snippets/foo' on SnippetController>
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/controller/resolve.rb:150:in
`raise_no_action'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/controller/resolve.rb:46:in `resolve'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/controller.rb:150:in `handle'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher/action.rb:17:in `process'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher.rb:85:in `filter'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher.rb:84:in `each'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher.rb:84:in `filter'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher.rb:44:in `dispatch'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher.rb:43:in `catch'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher.rb:43:in `dispatch'
[2007-07-19 22:23:37] ERROR
/home/lasso/darcs/ramaze/lib/ramaze/dispatcher.rb:42:in `catch'
In the case of a 500 error I think this information is vital, but not
for 404:s. The first line really tells all there is to know. This is of
course purely cosmetic, but also affects file size when logging to file.
Thanks again for the quick patch!
/lasso
--
________________________________________
Lars Olsson
lasso at lassoweb.se
http://www.lassoweb.se/
More information about the Ramaze-general
mailing list