@inrupt/solid-client-errors
    Preparing search index...

    Function handleErrorResponse

    • Map an HTTP error response to one of the Error classes exported by this library.

      Parameters

      • responseMetadata: { headers: Headers; status: number; statusText: string; url: string }

        the response metadata

      • responseBody: string

        the response body

      • message: string

        the error message

      Returns ClientHttpError

      an instance of the ClientHttpError subclass matching the response metadata status. If the response status is unkown, the generic ClientHttpError class is used.

      const response = await fetch("https://example.org/resource");
      if (!response.ok) {
      const responseBody = await response.text();
      throw handleErrorResponse(response, responseBody, "Fetch got error response");
      }

      0.0.1