com.jimuwd.xian.registry-proxy 1.1.18 → 1.1.19
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.
- package/dist/server/index.js +11 -13
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -199,21 +199,19 @@ async function _fetchFromRegistry(registry, targetUrl, reqFromDownstreamClient)
|
|
|
199
199
|
}
|
|
200
200
|
catch (e) {
|
|
201
201
|
// Fetch form one of the configured upstream registries failed, this is expected behavior, not error.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
// Other net error code, print log with stacktrace
|
|
212
|
-
logger.warn(`Failed to fetch from ${targetUrl}, ${e.message}`, e);
|
|
213
|
-
}
|
|
202
|
+
const errCode = e?.code;
|
|
203
|
+
if (errCode === 'ECONNREFUSED') {
|
|
204
|
+
logger.info(`Upstream ${targetUrl} refused connection [ECONNREFUSED], skip fetching from registry ${registry.normalizedRegistryUrl}`);
|
|
205
|
+
}
|
|
206
|
+
else if (errCode === 'ENOTFOUND') {
|
|
207
|
+
logger.info(`Unknown hostname in upstream url ${targetUrl} [ENOTFOUND], skip fetching from registry ${registry.normalizedRegistryUrl}.`);
|
|
208
|
+
}
|
|
209
|
+
else if (errCode === 'EAI_AGAIN') {
|
|
210
|
+
logger.info(`Could not resolve hostname in upstream url ${targetUrl} [EAI_AGAIN], skip fetching from registry ${registry.normalizedRegistryUrl}.`);
|
|
214
211
|
}
|
|
215
212
|
else {
|
|
216
|
-
|
|
213
|
+
// Other net error code, print log with stacktrace
|
|
214
|
+
logger.warn(`Failed to fetch from ${targetUrl}`, e);
|
|
217
215
|
}
|
|
218
216
|
// Return null means skipping current upstream registry.
|
|
219
217
|
return null;
|