function reqRegionForNetworkingError(resp, done) {
    if (!AWS.util.isBrowser()) {
      return done();
    }
    var error = resp.error;
    var request = resp.request;
    var bucket = request.params.Bucket;
    if (!error || error.code !== 'NetworkingError' || !bucket ||
        request.httpRequest.region === 'us-east-1') {
      return done();
    }
    var service = request.service;
    var bucketRegionCache = service.bucketRegionCache;
    var cachedRegion = bucketRegionCache[bucket] || null;

    if (cachedRegion && cachedRegion !== request.httpRequest.region) {
      service.updateReqBucketRegion(request, cachedRegion);
      done();
    } else if (!service.dnsCompatibleBucketName(bucket)) {
      service.updateReqBucketRegion(request, 'us-east-1');
      if (bucketRegionCache[bucket] !== 'us-east-1') {
        bucketRegionCache[bucket] = 'us-east-1';
      }
      done();
    } else if (request.httpRequest.virtualHostedBucket) {
      var getRegionReq = service.listObjects({Bucket: bucket, MaxKeys: 0});
      service.updateReqBucketRegion(getRegionReq, 'us-east-1');
      getRegionReq._requestRegionForBucket = bucket;

      getRegionReq.send(function() {
        var region = service.bucketRegionCache[bucket] || null;
        if (region && region !== request.httpRequest.region) {
          service.updateReqBucketRegion(request, region);
        }
        done();
      });
    } else {
      // DNS-compatible path-style
      // (s3ForcePathStyle or bucket name with dot over https)
      // Cannot obtain region information for this case
      done();
    }
   }
function reqRegionForNetworkingError(resp, done) {
    if (!AWS.util.isBrowser()) {
      return done();
    }
    var error = resp.error;
    var request = resp.request;
    var bucket = request.params.Bucket;
    if (!error || error.code !== 'NetworkingError' || !bucket ||
        request.httpRequest.region === 'us-east-1') {
      return done();
    }
    var service = request.service;
    var bucketRegionCache = service.bucketRegionCache;
    var cachedRegion = bucketRegionCache[bucket] || null;

    if (cachedRegion && cachedRegion !== request.httpRequest.region) {
      service.updateReqBucketRegion(request, cachedRegion);
      done();
    } else if (!service.dnsCompatibleBucketName(bucket)) {
      service.updateReqBucketRegion(request, 'us-east-1');
      if (bucketRegionCache[bucket] !== 'us-east-1') {
        bucketRegionCache[bucket] = 'us-east-1';
      }
      done();
    } else if (request.httpRequest.virtualHostedBucket) {
      var getRegionReq = service.listObjects({Bucket: bucket, MaxKeys: 0});
      service.updateReqBucketRegion(getRegionReq, 'us-east-1');
      getRegionReq._requestRegionForBucket = bucket;

      getRegionReq.send(function() {
        var region = service.bucketRegionCache[bucket] || null;
        if (region && region !== request.httpRequest.region) {
          service.updateReqBucketRegion(request, region);
        }
        done();
      });
    } else {
      // DNS-compatible path-style
      // (s3ForcePathStyle or bucket name with dot over https)
      // Cannot obtain region information for this case
      done();
    }
   }
function reqRegionForNetworkingError ( resp , done ) { if ( ! AWS . util . isBrowser ( ) ) { return done ( ) ; } var error = resp . error ; var request = resp . request ; var bucket = request . params . Bucket ; if ( ! error || error . code !== 'NetworkingError' || ! bucket || request . httpRequest . region === 'us-east-1' ) { return done ( ) ; } var service = request . service ; var bucketRegionCache = service . bucketRegionCache ; var cachedRegion = bucketRegionCache [ bucket ] || null ; if ( cachedRegion && cachedRegion !== request . httpRequest . region ) { service . updateReqBucketRegion ( request , cachedRegion ) ; done ( ) ; } else if ( ! service . dnsCompatibleBucketName ( bucket ) ) { service . updateReqBucketRegion ( request , 'us-east-1' ) ; if ( bucketRegionCache [ bucket ] !== 'us-east-1' ) { bucketRegionCache [ bucket ] = 'us-east-1' ; } done ( ) ; } else if ( request . httpRequest . virtualHostedBucket ) { var getRegionReq = service . listObjects ( { Bucket : bucket , MaxKeys : 0 } ) ; service . updateReqBucketRegion ( getRegionReq , 'us-east-1' ) ; getRegionReq . _requestRegionForBucket = bucket ; getRegionReq . send ( function ( ) { var region = service . bucketRegionCache [ bucket ] || null ; if ( region && region !== request . httpRequest . region ) { service . updateReqBucketRegion ( request , region ) ; } done ( ) ; } ) ; } else { // DNS-compatible path-style // (s3ForcePathStyle or bucket name with dot over https) // Cannot obtain region information for this case done ( ) ; } }
For browser only. If NetworkingError received, will attempt to obtain
the bucket region.

@api private
For browser only . If NetworkingError received will attempt to obtain the bucket region .
If the error is not a NetworkingError then we need to get the region information from the bucket.