@grafctory/http - v0.9.0
    Preparing search index...

    Function toProblem

    • Converts a value to a Problem.

      Normalises whatever a failed exchange surfaces into a single shape callers may branch on:

      • a value already qualifying as a Problem is taken as it stands
      • an Error contributes its name as title and its message as detail
      • any other JSON value is carried as report
      • anything else is rendered as detail

      Values other than problems are assigned the NetworkError status, as no origin server assigned them one. A failure raised as a value thus carries the same status as a network error Response.

      Stack traces and causes are left out, as a problem is expected to travel beyond the process that raised it.

      Parameters

      • value: unknown

        The value to convert

      Returns Problem

      An immutable Problem describing value