Exception: Zizq::ResponseError

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

Overview

HTTP error — the server returned a non-success status code. Carries the status code and parsed body.

Direct Known Subclasses

ClientError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status:, body: nil) ⇒ ResponseError

Create a new ResponseError with the given error message, response status and decoded response body.



25
26
27
28
29
# File 'lib/zizq/error.rb', line 25

def initialize(message, status:, body: nil) #: (String, status: Integer, ?body: Hash[String, untyped]?) -> void
  @status = status
  @body = body
  super(message)
end

Instance Attribute Details

#bodyObject (readonly)

The decoded body of the error response.



21
22
23
# File 'lib/zizq/error.rb', line 21

def body
  @body
end

#statusObject (readonly)

The HTTP response status from the Zizq server.



18
19
20
# File 'lib/zizq/error.rb', line 18

def status
  @status
end