Sha256: 41c1aba3cc53888fb9db3825c4fd18bb1b9d07a7d749d8fac0cdf4d91fdf78c1

Contents?: true

Size: 1.48 KB

Versions: 15

Compression:

Stored size: 1.48 KB

Contents

module Pancake
  module Errors
    class HttpError < StandardError
      class_inheritable_accessor :name, :code, :description

      def name; self.class.name; end

      def code; self.class.code; end
      alias_method :status, :code

      def description; self.class.description; end
    end

    class NotFound < HttpError
      self.name = "Not Found"
      self.code = 404
      self.description = "The requested resource could not be found but may be available again in the future."
    end

    class UnknownRouter < NotFound
      self.description = "The router could not be found"
    end

    class UnknownConfiguration < NotFound
      self.description = "The configuration could not be found"
    end

     class Unauthorized < HttpError
       self.name = "Unauthorized"
       self.code = 401
       self.description = "Authentication is required to access this resource."
     end

     class Forbidden < HttpError
       self.name = "Forbidden"
       self.code = 403
       self.description = "Access to this resource is denied."
     end

     class Server < HttpError
       attr_accessor :exceptions

       self.name = "Server Error"
       self.code = 500
       self.description = "An internal server error"

       def initialize(*args)
         super
         @exceptions = []
       end
     end

     class NotAcceptable < HttpError
       self.name =  "Not Acceptable"
       self.code = 406
       self.description = "The requeseted format could not be provided"
     end



  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pancake-0.1.29 lib/pancake/errors.rb
pancake-0.1.28 lib/pancake/errors.rb
pancake-0.1.27 lib/pancake/errors.rb
pancake-0.1.26 lib/pancake/errors.rb
pancake-0.1.25 lib/pancake/errors.rb
pancake-0.1.24 lib/pancake/errors.rb
pancake-0.1.22 lib/pancake/errors.rb
pancake-0.1.20 lib/pancake/errors.rb
pancake-0.1.19 lib/pancake/errors.rb
pancake-0.1.18 lib/pancake/errors.rb
pancake-0.1.17 lib/pancake/errors.rb
pancake-0.1.16 lib/pancake/errors.rb
pancake-0.1.15 lib/pancake/errors.rb
pancake-0.1.13 lib/pancake/errors.rb
pancake-0.1.12 lib/pancake/errors.rb