class Lato::ApplicationController
def catch_exceptions
def catch_exceptions yield rescue => exception Rails.logger.error(exception.message) Rails.logger.error(exception.backtrace.join("\n")) if exception.is_a?(ActiveRecord::RecordNotFound) respond_to_with_not_found else respond_to_with_error(exception) end end