Sha256: 88db0b8e83066a68eaad9356151293f2f2de9c87c1e3cbb3fab77d3df7341ba5

Contents?: true

Size: 789 Bytes

Versions: 5

Compression:

Stored size: 789 Bytes

Contents

# encoding: utf-8

require 'descendants_tracker'

module Github
  module Error
    class GithubError < StandardError
      extend DescendantsTracker

      attr_reader :response_message, :response_headers

      # Initialize a new Github error object.
      #
      def initialize(message = $!)
        if message.respond_to?(:backtrace)
          super(message.message)
          @response_message = message
        else
          super(message.to_s)
        end
      end

      def backtrace
        if @response_message && @response_message.respond_to?(:backtrace)
          @response_message.backtrace
        else
          super
        end
      end
    end # GithubError
  end # Error
end # Github

require 'github_api/error/service_error'
require 'github_api/error/client_error'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
github_api-0.17.0 lib/github_api/error.rb
github_api-0.16.0 lib/github_api/error.rb
github_api-0.15.0 lib/github_api/error.rb
github_api-0.14.5 lib/github_api/error.rb
github_api-0.14.4 lib/github_api/error.rb