Sha256: 06173f5423fe2f25d194d2f6e3dfeb457890f7921bfce1f7e053f6ef301a6771

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 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 }

      @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.3 lib/frank/rescue.rb
frank-0.2.2 lib/frank/rescue.rb
frank-0.2.1 lib/frank/rescue.rb