Exception: GH::Error

Inherits:
Exception
  • Object
show all
Defined in:
lib/gh/error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error = nil, payload = nil) ⇒ Error

Returns a new instance of Error.



11
12
13
14
15
# File 'lib/gh/error.rb', line 11

def initialize(error = nil, payload = nil)
  error = error.error while error.respond_to? :error
  @error, @payload = error, payload
  set_backtrace error.backtrace if error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



5
6
7
# File 'lib/gh/error.rb', line 5

def error
  @error
end

#payloadObject (readonly)

Returns the value of attribute payload.



5
6
7
# File 'lib/gh/error.rb', line 5

def payload
  @payload
end

Class Method Details

.new(error) ⇒ Object



7
8
9
# File 'lib/gh/error.rb', line 7

def self.new(error, *)
  Error === error ? error : super
end

Instance Method Details

#messageObject



17
18
19
# File 'lib/gh/error.rb', line 17

def message
  "GH request failed (#{error.class}: #{error.message}) with payload: #{short(payload.inspect)}"
end