Sha256: eb85d2cd17f3ccc65a2c99965927a2ff23134fafda80039da0300861b5ccb30c

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

module Frank
  module Rescue    
    
    def render_404
      template = File.expand_path(File.dirname(__FILE__)) + '/templates/404.haml'
      locals = { :request => @env, 
                 :dynamic_folder => @dynamic_folder, 
                 :static_folder => @static_folder,
                 :environment => @environment }
                 
      @response['Content-Type'] = 'text/html'
      @response.status = 404
      @response.body = Tilt.new(template, 1).render(Object.new, locals = locals)
      log_request('404')
    end
  
    def render_500(excp)
      template = File.expand_path(File.dirname(__FILE__)) + '/templates/500.haml'
      locals = { :request => @env, :params => @request.params, :exception => excp }

      @response['Content-Type'] = 'text/html'
      @response.status = 500
      @response.body = Tilt.new(template, 1).render(Object.new, locals = locals)   
      log_request('500', excp)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frank-0.2.6 lib/frank/rescue.rb
frank-0.2.5 lib/frank/rescue.rb
frank-0.2.4 lib/frank/rescue.rb