static fetchError(fetchOptions, response) {
        const httpStatus = response.status,
            defaults = {
                name: 'HTTP Error ' + (httpStatus || ''),
                message: response.statusText,
                httpStatus,
                serverDetails: response.responseText,
                fetchOptions
            };

        if (httpStatus === 401) {
            return this.createInternal(defaults, {
                name: 'Unauthorized',
                message: 'Your session may have timed out and you may need to log in again.'
            });
        }

        // Try to "smart" decode as server provided JSON Exception (with a name)
        try {
            const cType = response.headers.get('Content-Type');
            if (cType && cType.includes('application/json')) {
                const serverDetails = JSON.parse(response.responseText);
                if (serverDetails?.name) {
                    return this.createInternal(defaults, {
                        name: serverDetails.name,
                        message: serverDetails.message,
                        isRoutine: serverDetails.isRoutine ?? false,
                        serverDetails
                    });
                }
            }
        } catch (ignored) {}

        // Fall back to raw defaults
        return this.createInternal(defaults, {});
    }
/**
     * Create an Error to throw when a fetch call returns a !ok response.
     * @param {Object} fetchOptions - original options provided to `FetchService.fetch()`.
     * @param {Response} response - return value of native fetch, with the addition of an optional
     *      `responseText` property containing the already-awaited output of `response.text()`. If
     *      `responseText` is determined to be a JSON object containing a `name` property, it will
     *      be treated as a serialized exception and used to construct the returned Error.
     * @returns {Error}
     */
Create an Error to throw when a fetch call returns a !ok response.
@param {Object} fetchOptions - original options provided to `FetchService.fetch()`.
@param {Response} response - return value of native fetch, with the addition of an optional
`responseText` property containing the already-awaited output of `response.text()`. If
`responseText` is determined to be a JSON object containing a `name` property, it will
be treated as a serialized exception and used to construct the returned Error.
@returns {Error}
Create an Error to throw when a fetch call returns a !ok response . @param { Object } fetchOptions - original options provided to ` FetchService . fetch () ` . @param { Response } response - return value of native fetch with the addition of an optional ` responseText ` property containing the already - awaited output of ` response . text () ` . If ` responseText ` is determined to be a JSON object containing a ` name ` property it will be treated as a serialized exception and used to construct the returned Error . @returns { Error }
static fetchError(fetchOptions, response) {
        const httpStatus = response.status,
            defaults = {
                name: 'HTTP Error ' + (httpStatus || ''),
                message: response.statusText,
                httpStatus,
                serverDetails: response.responseText,
                fetchOptions
            };
        if (httpStatus === 401) {
            return this.createInternal(defaults, {
                name: 'Unauthorized',
                message: 'Your session may have timed out and you may need to log in again.'
            });
        }
        try {
            const cType = response.headers.get('Content-Type');
            if (cType && cType.includes('application/json')) {
                const serverDetails = JSON.parse(response.responseText);
                if (serverDetails?.name) {
                    return this.createInternal(defaults, {
                        name: serverDetails.name,
                        message: serverDetails.message,
                        isRoutine: serverDetails.isRoutine ?? false,
                        serverDetails
                    });
                }
            }
        } catch (ignored) {}
        return this.createInternal(defaults, {});
    }
static fetchError ( fetchOptions , response ) { const httpStatus = response . status , defaults = { name : 'HTTP Error ' + ( httpStatus || '' ) , message : response . statusText , httpStatus , serverDetails : response . responseText , fetchOptions } ; if ( httpStatus === 401 ) { return this . createInternal ( defaults , { name : 'Unauthorized' , message : 'Your session may have timed out and you may need to log in again.' } ) ; } try { const cType = response . headers . get ( 'Content-Type' ) ; if ( cType && cType . includes ( 'application/json' ) ) { const serverDetails = JSON . parse ( response . responseText ) ; if ( serverDetails ?. name ) { return this . createInternal ( defaults , { name : serverDetails . name , message : serverDetails . message , isRoutine : serverDetails . isRoutine ?? false , serverDetails } ) ; } } } catch ( ignored ) { } return this . createInternal ( defaults , { } ) ; }
Create an Error to throw when a fetch call returns a !ok response.
Create an Error to throw when a fetch call returns a !ok response .
// Try to "smart" decode as server provided JSON Exception (with a name) // Fall back to raw defaults