Thursday, June 28, 2007

Ignoring common exceptions in exception_notification plugin

Exception Notification is a great plugin, that helps to you to get trace of exception on your app running in production mode. Without this plugin you probably would have to SSH to production machine and tail the production.log file to get last exception trace which is extremely inconvenient to do. FTP to get to production.log is also an option but production.log files tend to become too large. only problem is that you may get too many emails form this plugin especially when you have just launched your site in production mode.

some of the exception are not too much intresting like typical ActiveRecord::RecordNotFound exceptions, To ignore these kind of trivial exceptions you must overide it in rescue_action_in_public method of your application.rb file.

Here is how you do it:



def rescue_action_in_public(exception)
case exception
when ::ActiveRecord::RecordNotFound,
::ActionController::UnknownController,
::ActionController::UnknownAction,
::ActionController::RoutingError
render_404
else
render_500
deliverer = self.class.exception_data
data = case deliverer
when nil then {}
when Symbol then send(deliverer)
when Proc then deliverer.call(self)
end
ExceptionNotifier.deliver_exception_notification(exception, self, request, data)
end
end

Sunday, June 24, 2007

Capistrano 2 and custom SCM modules

I was using Capistrano 2 to deploy our latest project, as we had our SVN repository behind the corporate firewall and was not accessible remotely. I had originally planned to use a custom SCM module for local svn access.

I discovered that custom SCM modules are not supported at the moment in Capistrano 2.

If there are any workarounds i would be interested to know about them