Right way to handle exceptions of controller actions?

Hi all,

I use rescue_action_in_public(e) and rescue_action_locally(e) methods
for
catching the controller exceptions. I render some templates, also the
standard error static html pages. Is there any other standard way to
handle
controller exceptions?

Regards,
Anil W.

I render some templates, also the

standard error static html pages. Is there any other standard way to
handle
controller exceptions?

checkit:

def action_in_controller

a couple of bad statements that raise errors; per error, it gets

sent to the

rescue clause that catches that specific error:

foo = 5 + “string” # TypeError
bar = ActiveRecordModel.find(23452345234523452345234) #
RecordNotFound
blah = “nochie” + un_inited_var



rescue TypeError
render_text “we added two bad datatypes”
rescue RecordNotFound
render_text “we looked up a record that doesn’t exist”
rescue
render_text “generic rescue”
end

:slight_smile:

shai

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs