function friendlyFetchError
friendlyFetchError(err: unknown): string

Returns the message to show for err, an error caught around a request. A TypeError means the request never reached the server (no network, CORS), and gets a message saying so. The server's own messages come through as they are.

Parameters

err: unknown

Return Type

string

Usage

import { friendlyFetchError } from "src/utils/shared/api.ts";