Sha256: 4ec8f53d6ec68e6547116aa349688d3ca3b25d0a1052ef9e27edae8b2d569ca1

Contents?: true

Size: 517 Bytes

Versions: 9

Compression:

Stored size: 517 Bytes

Contents

module Restfully
  module HTTP
    class Error < Restfully::Error
      attr_reader :response
      def initialize(response)
        @response = response
        if response.body.kind_of?(Hash)
          message = "#{response.status} #{response.body['title']}. #{response.body['message']}"
        else
          message = response.body
        end
        super(message)
      end
    end
    class ClientError < Restfully::HTTP::Error; end
    class ServerError < Restfully::HTTP::Error; end
  end
end
      
      

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
crohr-restfully-0.2.1 lib/restfully/http/error.rb
crohr-restfully-0.2.2 lib/restfully/http/error.rb
restfully-0.4.0 lib/restfully/http/error.rb
restfully-0.3.2 lib/restfully/http/error.rb
restfully-0.3.1 lib/restfully/http/error.rb
restfully-0.3.0 lib/restfully/http/error.rb
restfully-0.2.3 lib/restfully/http/error.rb
restfully-0.2.2 lib/restfully/http/error.rb
restfully-0.2.1 lib/restfully/http/error.rb