Class: Gitlab::BeyondIdentity::Client::ApiError

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/beyond_identity/client.rb

Constant Summary collapse

ACCEPTABLE_ERROR_CODES =
[404].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code) ⇒ ApiError

Returns a new instance of ApiError.



15
16
17
18
# File 'lib/gitlab/beyond_identity/client.rb', line 15

def initialize(message, code)
  @code = code
  @message = message
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



13
14
15
# File 'lib/gitlab/beyond_identity/client.rb', line 13

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



13
14
15
# File 'lib/gitlab/beyond_identity/client.rb', line 13

def message
  @message
end

Instance Method Details

#acceptable_error?Boolean

In some cases, we treat error response as acceptable:

A GPG key that wasn’t issued by BeyondIdentity returns 404 status code but users should be able to add those GPG keys to their profile.

Returns:



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

def acceptable_error?
  ACCEPTABLE_ERROR_CODES.include?(code)
end