Sha256: 0aeeaffecbe2b6385c0881e5c37e328e55b030713ab55874fe61a43b9b0f2cc8

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

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
      obj                       = Object.new.extend(TemplateHelpers)
      @response.body            = Tilt::HamlTemplate.new(template).render(obj, 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
      obj                       = Object.new.extend(TemplateHelpers)
      @response.body            = Tilt::HamlTemplate.new(template).render(obj, locals = locals)  
      
      log_request('500', excp)
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
frank-0.3.2 lib/frank/rescue.rb
frank-0.3.1 lib/frank/rescue.rb
frank-0.3.0 lib/frank/rescue.rb
frank-0.3.0.beta2 lib/frank/rescue.rb
frank-0.3.0.beta lib/frank/rescue.rb