JoobQ.SdkTooOldError exception (joobq_ex v0.8.0)

Copy Markdown View Source

The gateway refuses this SDK's version: 426 sdk_too_old, when the server's JOOBQUI_SDK_MIN_VERSION is above it. Every call answers it until the SDK is upgraded, so none is made again: a producer call answers {:error, %JoobQ.SdkTooOldError{}} (its ! variant raises it), and a worker that meets it stops at once (see JoobQ.Config, :queues).

It has the fields of JoobQ.Error (reason is :sdk_too_old, status 426, code, message, details, request_id), so code that reads those reads it too, and min, server and sdk, the versions of details: the oldest the server supports, the server's and this SDK's as the server read it (nil when the answer had none). A 426 whose body cannot be read is still this error, with an empty code and message; its message then names what the body began with (body, its first 200 characters). The gateway's text is cleaned: one line, without control or format characters, trimmed, at most 300 characters (100 for code and the versions). jq_code and docs_url are read as JoobQ.Error reads them; with a jq_code, the message (and so the worker's log line) ends with [<jq_code>] <docs_url>.

Summary

Functions

The error for a 426 answer and its body (decoded JSON, or the raw text), and the raw body the gateway sent (what body holds the start of).

Types

t()

@type t() :: %JoobQ.SdkTooOldError{
  __exception__: true,
  body: String.t(),
  code: String.t(),
  details: %{optional(String.t()) => String.t()},
  docs_url: String.t() | nil,
  jq_code: String.t() | nil,
  message: String.t(),
  min: String.t() | nil,
  reason: :sdk_too_old,
  request_id: String.t() | nil,
  sdk: String.t() | nil,
  server: String.t() | nil,
  status: 426
}

Functions

from_response(decoded, raw \\ "")

@spec from_response(term(), binary()) :: t()

The error for a 426 answer and its body (decoded JSON, or the raw text), and the raw body the gateway sent (what body holds the start of).