Plugins - exception_handler
Add to favoritesAllows you to register handlers for exceptions in your controllers like:
class ApplicationController < ActionController::Base
class NotAuthorized < RuntimeError;end
register_exception NotAuthorized, :not_authorized
private
def not_authorized
flash[ :error ] = 'You are not authorized to perform the requested ' +
'action.'
render :text => '', :layout => true, :status => 401
end
end
In this example, you could raise an ApplicationController::NotAuthorized exception anywhere in the course of processing an action, and instead of just getting an error report or a 500 error in the browser, the user would see the page with your error message and the browser gets a 401 status code.
http://johnwilger.com/pages/exception_handler
svn://source.johnwilger.com/plugins/exception_handler
PublicDomain
Controllers

This svn repository does not seem to be up anymore.