forked from piotrmurach/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.rb
More file actions
32 lines (27 loc) · 686 Bytes
/
error.rb
File metadata and controls
32 lines (27 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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