Gleanex.ProblemDetail (Gleanex v0.1.0)

Copy Markdown View Source

An RFC 7807 problem detail returned by Glean.

Glean's Platform API defines ProblemDetail as its error body, and the other APIs return it for most 4xx and 5xx responses. This is the transport-level normalisation of that body: it is parsed with no schema lookup so that error handling works even for endpoints whose responses are not in the spec.

raw always holds the decoded body exactly as received, so nothing is lost when Glean adds fields.

Summary

Functions

A one line human readable summary.

Parse a decoded response body into a problem detail.

Types

error_item()

@type error_item() :: %{optional(atom()) => term()}

t()

@type t() :: %Gleanex.ProblemDetail{
  code: String.t() | nil,
  detail: String.t() | nil,
  errors: [error_item()],
  instance: String.t() | nil,
  raw: map(),
  status: integer() | nil,
  title: String.t() | nil,
  type: String.t() | nil
}

Functions

message(problem)

@spec message(t()) :: String.t()

A one line human readable summary.

parse(body)

@spec parse(term()) :: t() | nil

Parse a decoded response body into a problem detail.

Returns nil for bodies that carry none of the RFC 7807 fields, so callers can fall back to a plain HTTP error.