function interceptPromiseResponse(hasIntercepted, promise, doneHookInfo) {
    let {hook} = doneHookInfo;
    return promise.then(
        res => (hasIntercepted ? doneHookInfo.resData : hook(null, res)),
        err => {
            // check whether is intercepted to avoid repeated interception
            if (hasIntercepted) {
                let {resException, resData} = doneHookInfo;
                if (resException) {
                    throw resData;
                }
                return resData;
            }

            return hook(err || /* istanbul ignore next */ 'err');
        }
    );
}
function interceptPromiseResponse(hasIntercepted, promise, doneHookInfo) {
    let {hook} = doneHookInfo;
    return promise.then(
        res => (hasIntercepted ? doneHookInfo.resData : hook(null, res)),
        err => {
            
            if (hasIntercepted) {
                let {resException, resData} = doneHookInfo;
                if (resException) {
                    throw resData;
                }
                return resData;
            }

            return hook(err ||  'err');
        }
    );
}
function interceptPromiseResponse ( hasIntercepted , promise , doneHookInfo ) { let { hook } = doneHookInfo ; return promise . then ( res => ( hasIntercepted ? doneHookInfo . resData : hook ( null , res ) ) , err => { // check whether is intercepted to avoid repeated interception if ( hasIntercepted ) { let { resException , resData } = doneHookInfo ; if ( resException ) { throw resData ; } return resData ; } return hook ( err || /* istanbul ignore next */ 'err' ) ; } ) ; }
Intercept the API promise response

@inner
@param {boolean} hasIntercepted whether intercepted by the API call arguments
@param {Promise} promise the promise response
@param {Object} doneHookInfo the done hook info
@return {Promise}
Intercept the API promise response