On 22 Feb 2008, at 00:59, Mr_Tibs wrote:
>
> Hi,
>
> I asked this question on railsforum.com but nobody replied yet. I
> wanted to know how new recoverable and unrecoverable exceptions should
> be handled.
>
> Unrecoverable exceptions for standard CRUD operations render the 500
> page. What if I write a new set of actions that might generate an
> exception? Should I wrap the whole action into a ''begin-rescue
> Exception'' block and display a flash warning to the user, or is it
the
> Rails way to let it be rescued by the base action controller which
> displays the 500 page?
>
> The recoverable exceptions are more straight forward. Code which
> raises these errors should be wrapped in ''begin-rescue
MyException''
> blocks, and then displayed as a warning to the users, right?
>
in 2.0 in the controller you can stick
rescue_from SomeException, SomeOtherException, :with
=> :some_error_handler
def some_error_handler(exception)
#do something appropriate (eg display message to use)
end
in your controller, to commonalizer things like displaying an error
message
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---