AudioProxy.OptionError (audio_proxy v0.4.0)

Copy Markdown View Source

A rejected options segment, as data (API doc §3, §5).

Every parse or validation failure names the offending segment in its canonical key:value spelling plus a machine-readable reason. The HTTP slice renders these as the 422 JSON body; nothing here knows about HTTP.

For cross-key conflicts (br with q) the segment is the one that could not be accepted given the rest, and related names its counterpart.

Summary

Types

Why a segment was rejected.

t()

Functions

A short human-readable sentence for error, for the 422 body's message.

Builds an error for segment with reason, optionally naming a related segment for cross-key conflicts.

Types

reason()

@type reason() ::
  :empty_segment
  | :missing_value
  | :unknown_key
  | :duplicate_key
  | :invalid_integer
  | :invalid_number
  | :excessive_precision
  | :invalid_value
  | :out_of_range
  | :control_character
  | :mutually_exclusive
  | :requires_lossless_format
  | :requires_lossy_format
  | :requires_peaks_format
  | :unsupported_for_peaks
  | :unsupported_for_format
  | :out_of_range_for_format
  | :requires_bounded_trim
  | :sample_rate_above_lossy_cap
  | :fade_exceeds_duration
  | :info_takes_no_options

Why a segment was rejected.

Grouped by origin: shape (:empty_segment..:duplicate_key), value domain (:invalid_integer..:out_of_range), and cross-key rules (:mutually_exclusive..:fade_exceeds_duration).

t()

@type t() :: %AudioProxy.OptionError{
  reason: reason(),
  related: String.t() | nil,
  segment: String.t()
}

Functions

message(error)

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

A short human-readable sentence for error, for the 422 body's message.

new(segment, reason, related \\ nil)

@spec new(String.t(), reason(), String.t() | nil) :: t()

Builds an error for segment with reason, optionally naming a related segment for cross-key conflicts.