motoko 3.5.1 → 3.5.3

Sign up to get free protection for your applications and to get access to all the features.
package/src/package.ts CHANGED
@@ -66,7 +66,6 @@ async function fetchPackageFiles(
66
66
  }
67
67
  const repoPart = info.repo.slice(prefix.length, -suffix.length);
68
68
 
69
- // TODO: modify condition?
70
69
  const possiblyCDN = !(
71
70
  (info.branch &&
72
71
  info.branch.length % 2 === 0 &&
@@ -75,16 +74,21 @@ async function fetchPackageFiles(
75
74
  info.branch === 'main'
76
75
  );
77
76
  if (possiblyCDN) {
78
- const result = await fetchFromService(
79
- info,
80
- 'CDN',
81
- `https://data.jsdelivr.com/v1/package/gh/${repoPart}@${info.branch}/flat`,
82
- `https://cdn.jsdelivr.net/gh/${repoPart}@${info.branch}`,
83
- 'files',
84
- 'name',
85
- );
86
- if (result?.length) {
87
- return result;
77
+ try {
78
+ const result = await fetchFromService(
79
+ info,
80
+ 'CDN',
81
+ `https://data.jsdelivr.com/v1/package/gh/${repoPart}@${info.branch}/flat`,
82
+ `https://cdn.jsdelivr.net/gh/${repoPart}@${info.branch}`,
83
+ 'files',
84
+ 'name',
85
+ );
86
+ if (result?.length) {
87
+ return result;
88
+ }
89
+ }
90
+ catch(err) {
91
+ console.error('[CDN]', err);
88
92
  }
89
93
  }
90
94
  return await fetchFromService(