gleetube/error

Types

Detail from an individual YouTube API error entry.

pub type ApiErrorDetail {
  ApiErrorDetail(
    domain: String,
    reason: String,
    message: String,
    location_type: option.Option(String),
    location: option.Option(String),
  )
}

Constructors

  • ApiErrorDetail(
      domain: String,
      reason: String,
      message: String,
      location_type: option.Option(String),
      location: option.Option(String),
    )

All possible errors from GleeTube operations.

pub type GleeTubeError {
  ApiError(
    status: Int,
    message: String,
    errors: List(ApiErrorDetail),
  )
  HttpError(message: String)
  AuthError(message: String)
  DecodeError(message: String)
  MissingParamsError(message: String)
}

Constructors

  • ApiError(
      status: Int,
      message: String,
      errors: List(ApiErrorDetail),
    )

    YouTube API returned an error response (4xx/5xx).

  • HttpError(message: String)

    HTTP transport failure (connection refused, timeout, TLS error).

  • AuthError(message: String)

    Authentication or authorization issue.

  • DecodeError(message: String)

    JSON decode failure.

  • MissingParamsError(message: String)

    Required parameter missing at runtime.

Values

pub fn decode_api_error(
  status: Int,
  body: String,
) -> GleeTubeError

Parse a YouTube API error response body into an ApiError. Always succeeds — falls back to raw body as message if JSON parsing fails.

Search Document