• Helper function which can be used directly in the onError field of a ResultMapper to produce an error type of NamedAPIError. This can handle server-provided errors which conform to the right type, as well as server or local errors which do not.

    This function will allow the server to specify error contents via an error field in the resulting JSON. Fields which aren't provided by the server (or which aren't the expected type) will be filled in by this function instead. Unknown fields from the server will be passed through unmodified.

    The APIResult returned is always an error with success===false. The result type here is only a placeholder.

    Type Parameters

    • TResult

    Parameters

    • resText: string
    • errorCode: undefined | number

    Returns Promise<APIResult<TResult, NamedAPIError>>

Generated using TypeDoc