Exception: Gitlab::Error::ResponseError

Inherits:
Error
  • Object
show all
Defined in:
lib/gitlab/error.rb

Overview

Custom error class for rescuing from HTTP response errors.

Constant Summary collapse

POSSIBLE_MESSAGE_KEYS =
%i(message error_description error)

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ResponseError

Returns a new instance of ResponseError.



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

def initialize(response)
  @response = response
  super(build_error_message)
end

Instance Method Details

#response_messageString

Body content returned in the HTTP response

Returns:

  • (String)


31
32
33
# File 'lib/gitlab/error.rb', line 31

def response_message
  @response.parsed_response.message
end

#response_statusInteger

Status code returned in the HTTP response.

Returns:

  • (Integer)


24
25
26
# File 'lib/gitlab/error.rb', line 24

def response_status
  @response.code
end