Sha256: 4c649908c5e7e4c1adda0928ceba2e1d4e95c1fb9adac3541365243e158ce150

Contents?: true

Size: 854 Bytes

Versions: 1

Compression:

Stored size: 854 Bytes

Contents

# encoding: utf-8

module Github
  module Error
    class GithubError < StandardError
      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
        @response_message ? @response_message.backtrace : super
      end

    end # GithubError
  end # Error
end # Github

%w[
  service_error
  bad_request
  unauthorized
  forbidden
  not_found
  not_acceptable
  unprocessable_entity
  internal_server_error
  service_unavailable
  client_error
  invalid_options
  required_params
  unknown_value
  validations
].each do |error|
  require "github_api/error/#{error}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
github_api-0.6.4 lib/github_api/error.rb