Class: Camping::Controllers::ServerError

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/camping-unabridged.rb,
lib/camping.rb

Overview

The ServerError class is a special controller class for handling many (but not all) 500 errors. If there is a parse error in Camping or in your application’s source code, it will not be caught by Camping. The controller class k and request method m (GET, POST, etc.) where the error took place are passed in, along with the Exception e which can be mined for useful info.

module Camping::Controllers
  class ServerError
    def get(k,m,e)
      @status = 500
      div do
        h1 'Camping Problem!'
        h2 "in #{k}.#{m}"
        h3 "#{e.class} #{e.message}:"
        ul do
          e.backtrace.each do |bt|
            li bt
          end
        end
      end
    end
  end
end

Instance Attribute Summary

Attributes included from Base

#body, #cookies, #env, #headers, #input, #root, #status

Instance Method Summary collapse

Methods included from Base

#markaby, #markaview, #method_missing, #r, #redirect, #render, #service, #to_s

Methods included from Helpers

#/, #R, #errors_for

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Camping::Controllers::Base

Instance Method Details

#get(k, m, e) ⇒ Object



29
30
31
# File 'lib/camping.rb', line 29

def get(k,m,e);r(500,Mab.new{h1 "Cam\ping Problem!"
h2 "#{k}.#{m}";h3 "#{e.class} #{e.message}:";ul{e.backtrace.each{|bt|li(bt)}}}.to_s
)end