class

Zazu::Error

Inherits Exception < Reference < Object

The API error envelope, mirroring the other Zazu SDKs' hierarchy: { "error": { "type": ..., "message": ..., "param": ... } }. Match on #kind instead of subclassing.

Constructors

from_response(status : Int32, headers : HTTP::Headers, body : JSON::Any) : Error
Source
new(message : String, status : Int32, kind : String, type : String | Nil, param : String | Nil, request_id : String | Nil, retry_after : Int32 | Nil, body : JSON::Any)
Source

Instance methods

body

The full parsed response body.

Source
kind

One of: authentication, forbidden, not_found, validation, rate_limit, server, api.

Source
param

The API's error.param field.

Source
request_id

Value of the X-Request-Id response header.

Source
retry_after

Seconds to wait before retrying; only set for rate_limit (429).

Source
status

HTTP status code of the failed response.

Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
type

The API's error.type field.

Source