Module: Frank::Rescue

Included in:
Base
Defined in:
lib/frank/rescue.rb

Instance Method Summary collapse

Instance Method Details

#render_404Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/frank/rescue.rb', line 4

def render_404
  log_request('404')
  template = File.expand_path(File.dirname(__FILE__)) + '/templates/404.haml'
  locals = { :request => @env,
             :dynamic_folder => Frank.dynamic_folder,
             :static_folder => Frank.static_folder,
             :environment => Frank.environment }

  @response['Content-Type'] = 'text/html'
  @response.status          = 404

  obj = Object.new.extend(TemplateHelpers)
  Tilt::HamlTemplate.new(template).render(obj, locals = locals)
end

#render_500(excp) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/frank/rescue.rb', line 19

def render_500(excp)
  log_request('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)
  Tilt::HamlTemplate.new(template).render(obj, locals = locals)
end