Module: Yarn::ErrorPage

Included in:
AbstractHandler
Defined in:
lib/yarn/error_page.rb

Overview

HTML error pages

Instance Method Summary collapse

Instance Method Details

#serve_404_pageObject

Makes the response a 404 error page



7
8
9
10
11
# File 'lib/yarn/error_page.rb', line 7

def serve_404_page
  @response.status = 404
  fn = @request[:uri][:path] if @request
  @response.body = ["<html><head><title>404</title></head><body><h1>File #{fn} does not exist.</h1></body><html>"]
end

#serve_500_pageObject

Makes the response a 505 error page



14
15
16
17
# File 'lib/yarn/error_page.rb', line 14

def serve_500_page
  @response.status = 500
  @response.body = ["<h1>Yarn!?</h1>\nA server error occured."]
end