Fetch Client API Documentation - v1.1.1
    Preparing search index...

    Type Alias ErrorCode

    ErrorCode:
        | "HTTP_ERROR"
        | "TIMEOUT"
        | "NETWORK_ERROR"
        | "ABORTED"
        | "JSON_PARSE_ERROR"
        | "TEXT_PARSE_ERROR"
        | "BLOB_PARSE_ERROR"
        | "ARRAYBUFFER_PARSE_ERROR"
        | "UNKNOWN_ERROR"
        | `${string}_PARSE_ERROR`

    Error codes used by ApiError for categorizing different types of failures

    Standardized error codes to help identify and handle specific error types

    try {
    await client.get('/api/data');
    } catch (error) {
    if (error instanceof ApiError) {
    switch (error.code) {
    case 'HTTP_ERROR':
    console.log('Server returned error status:', error.status);
    break;
    case 'TIMEOUT':
    console.log('Request timed out - try again later');
    break;
    case 'NETWORK_ERROR':
    console.log('Network connectivity issue');
    break;
    case 'JSON_PARSE_ERROR':
    console.log('Invalid JSON response from server');
    break;
    }
    }
    }