Exception: Gitlab::Error::ResponseError
- Defined in:
- lib/gitlab/error.rb
Overview
Custom error class for rescuing from HTTP response errors.
Direct Known Subclasses
BadGateway, BadRequest, Conflict, ConnectionTimedOut, Forbidden, InternalServerError, MethodNotAllowed, NotAcceptable, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, Unprocessable
Constant Summary collapse
- POSSIBLE_MESSAGE_KEYS =
%i[message error_description error].freeze
Instance Method Summary collapse
-
#error_code ⇒ String
Additional error context returned by some API endpoints.
-
#initialize(response) ⇒ ResponseError
constructor
A new instance of ResponseError.
-
#response_message ⇒ String
Body content returned in the HTTP response.
-
#response_status ⇒ Integer
Status code returned in the HTTP response.
Constructor Details
#initialize(response) ⇒ ResponseError
Returns a new instance of ResponseError.
18 19 20 21 |
# File 'lib/gitlab/error.rb', line 18 def initialize(response) @response = response super() end |
Instance Method Details
#error_code ⇒ String
Additional error context returned by some API endpoints
40 41 42 43 44 45 46 |
# File 'lib/gitlab/error.rb', line 40 def error_code if @response.respond_to?(:error_code) @response.error_code else '' end end |
#response_message ⇒ String
Body content returned in the HTTP response
33 34 35 |
# File 'lib/gitlab/error.rb', line 33 def @response.parsed_response. end |
#response_status ⇒ Integer
Status code returned in the HTTP response.
26 27 28 |
# File 'lib/gitlab/error.rb', line 26 def response_status @response.code end |