@como/como-client 0.7.74 → 0.7.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/como.js +16 -6
  2. package/package.json +1 -1
  3. package/src/como.js +19 -14
package/lib/como.js CHANGED
@@ -989,33 +989,43 @@ var Como = function () {
989
989
  while (1) {
990
990
  switch (_context15.prev = _context15.next) {
991
991
  case 0:
992
+ _context15.prev = 0;
992
993
  resource = this.comoData.mainResourcesMap[resourceId];
993
994
 
994
995
  if (resource) {
995
- _context15.next = 4;
996
+ _context15.next = 5;
996
997
  break;
997
998
  }
998
999
 
999
1000
  err = 'resource ' + resourceId + ' not found!';
1000
1001
  throw new Error(err);
1001
1002
 
1002
- case 4:
1003
+ case 5:
1003
1004
  _comoData8 = this.comoData, env = _comoData8.env_params, api = _comoData8.api;
1004
- _context15.next = 7;
1005
+ _context15.next = 8;
1005
1006
  return api.getLoyaltyResource(env.services_root_cdn, resource.id, 'Namespace' in resource ? resource.Namespace : 'location_' + this.comoData.locationId, resource.Version);
1006
1007
 
1007
- case 7:
1008
+ case 8:
1008
1009
  responseJson = _context15.sent;
1009
1010
 
1010
1011
 
1011
1012
  this.comoData.mainResources[resourceId] = responseJson;
1013
+ _context15.next = 16;
1014
+ break;
1012
1015
 
1013
- case 9:
1016
+ case 12:
1017
+ _context15.prev = 12;
1018
+ _context15.t0 = _context15['catch'](0);
1019
+
1020
+ console.log('downloadMainResource failed, resourceId:' + resourceId + ', locationId:' + locationId + ', this.comoData.mainResourcesMap: ' + this.comoData.mainResourcesMap + ', error: ' + _context15.t0);
1021
+ throw new Error(_context15.t0);
1022
+
1023
+ case 16:
1014
1024
  case 'end':
1015
1025
  return _context15.stop();
1016
1026
  }
1017
1027
  }
1018
- }, _callee15, this);
1028
+ }, _callee15, this, [[0, 12]]);
1019
1029
  }));
1020
1030
 
1021
1031
  function downloadMainResource(_x39) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.7.74",
3
+ "version": "0.7.75",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
package/src/como.js CHANGED
@@ -409,21 +409,26 @@ class Como {
409
409
  */
410
410
 
411
411
  async downloadMainResource(resourceId) {
412
- const resource = this.comoData.mainResourcesMap[resourceId];
413
- if (!resource) {
414
- const err = `resource ${resourceId} not found!`;
415
- throw new Error(err);
412
+ try{
413
+ const resource = this.comoData.mainResourcesMap[resourceId];
414
+ if (!resource) {
415
+ const err = `resource ${resourceId} not found!`;
416
+ throw new Error(err);
417
+ }
418
+
419
+ const { env_params: env, api } = this.comoData;
420
+ const responseJson = await api.getLoyaltyResource(
421
+ env.services_root_cdn,
422
+ resource.id,
423
+ ('Namespace' in resource) ? resource.Namespace : `location_${this.comoData.locationId}`,
424
+ resource.Version,
425
+ );
426
+
427
+ this.comoData.mainResources[resourceId] = responseJson;
428
+ }catch(e){
429
+ console.log(`downloadMainResource failed, resourceId:${resourceId}, locationId:${locationId}, this.comoData.mainResourcesMap: ${this.comoData.mainResourcesMap}, error: ${e}`);
430
+ throw new Error(e);
416
431
  }
417
-
418
- const { env_params: env, api } = this.comoData;
419
- const responseJson = await api.getLoyaltyResource(
420
- env.services_root_cdn,
421
- resource.id,
422
- ('Namespace' in resource) ? resource.Namespace : `location_${this.comoData.locationId}`,
423
- resource.Version,
424
- );
425
-
426
- this.comoData.mainResources[resourceId] = responseJson;
427
432
  }
428
433
 
429
434