Exception: Zitadel::Client::ApiError

Inherits:
ZitadelError
  • Object
show all
Defined in:
lib/zitadel/client/api_error.rb

Overview

Represents an HTTP error returned from the Zitadel API.

Exposes the HTTP status code, response headers, and response body.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, response_headers, response_body) ⇒ ApiError

Returns a new instance of ApiError.

Parameters:

  • code (Integer)

    HTTP status code

  • response_headers (Hash{String=>Array<String>})

    HTTP response headers

  • response_body (String, Typhoeus::Response)

    HTTP response body



23
24
25
26
27
28
# File 'lib/zitadel/client/api_error.rb', line 23

def initialize(code, response_headers, response_body)
  super("Error #{code}")
  @code = code
  @response_headers = response_headers
  @response_body = response_body
end

Instance Attribute Details

#codeInteger (readonly)

Returns HTTP status code.

Returns:

  • (Integer)

    HTTP status code



11
12
13
# File 'lib/zitadel/client/api_error.rb', line 11

def code
  @code
end

#response_bodyString, Typhoeus::Response (readonly)

Returns HTTP response body.

Returns:

  • (String, Typhoeus::Response)

    HTTP response body



17
18
19
# File 'lib/zitadel/client/api_error.rb', line 17

def response_body
  @response_body
end

#response_headersHash{String=>Array<String>} (readonly)

Returns HTTP response headers.

Returns:

  • (Hash{String=>Array<String>})

    HTTP response headers



14
15
16
# File 'lib/zitadel/client/api_error.rb', line 14

def response_headers
  @response_headers
end