Unrecoverable exception handling

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?

Thanks,
Tiberiu

On 22 Feb 2008, at 00:59, Mr_Tibs wrote:

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