Sha256: 220f41b1ca780fbcb616b4fc56cce5c0ccbc3f001226c329d4b1cadf38169ec5
Contents?: true
Size: 599 Bytes
Versions: 4
Compression:
Stored size: 599 Bytes
Contents
module Footrest module HttpError class ErrorBase < StandardError attr_reader :status, :body, :method, :response def initialize(response=nil) @response = response @status = @response[:status] @body = @response[:body] @method = @response[:method] super("HTTP ERROR: #{@status}") end end %w( BadRequest Unauthorized Forbidden NotFound MethodNotAllowed InternalServerError NotImplemented BadGateway ServiceUnavailable ).each do |error| const_set error.to_sym, Class.new(ErrorBase) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
footrest-0.2.0 | lib/footrest/http_error.rb |
footrest-0.1.3 | lib/footrest/http_error.rb |
footrest-0.1.2 | lib/footrest/http_error.rb |
footrest-0.1 | lib/footrest/http_error.rb |