Sha256: 5c3d9020d01a853c06df352d2beac054002d7e78975126a1cbfdb866a8a820bf

Contents?: true

Size: 686 Bytes

Versions: 6

Compression:

Stored size: 686 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.respond_to?(:backtrace)
          @response_message.backtrace
        else
          super
        end
      end
    end # GithubError
  end # Error
end # Github

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
github_api2-1.0.1 lib/github_api2/error.rb
github_api2-1.0.0 lib/github_api2/error.rb
github_api-0.19.0 lib/github_api/error.rb
lingfennan-github_api-0.18.2 lib/github_api/error.rb
github_api-0.18.2 lib/github_api/error.rb
github_api-0.18.1 lib/github_api/error.rb