@forge/cli-shared
9.3.1-next.2-experimental-f258a6d9.4.0-next.3
out/shared/error-handling.js~
out/shared/error-handling.jsModified+4−30
Index: package/out/shared/error-handling.js
===================================================================
--- package/out/shared/error-handling.js
+++ package/out/shared/error-handling.js
@@ -10,42 +10,16 @@
const assistant_cli_1 = require("./assistant-cli");
function isErrorWithAnalytics(e) {
return e.getAttributes !== undefined;
}
-const NETWORK_CONNECTIVITY_ERROR_CODES = new Set([
- 'ENOTFOUND',
- 'ECONNRESET',
- 'ECONNREFUSED',
- 'ECONNABORTED',
- 'ENETUNREACH',
- 'EHOSTUNREACH',
- 'EAI_AGAIN',
- 'ETIMEDOUT',
- 'UND_ERR_CONNECT_TIMEOUT',
- 'UND_ERR_HEADERS_TIMEOUT',
- 'UND_ERR_SOCKET'
-]);
-function isLikelyNetworkError(e) {
- if (!(e instanceof Error)) {
- return false;
- }
- if (e instanceof TypeError && e.message === 'fetch failed') {
- const causeCode = e.cause && typeof e.cause === 'object' && typeof e.cause.code === 'string'
- ? e.cause.code
- : undefined;
- return causeCode ? NETWORK_CONNECTIVITY_ERROR_CODES.has(causeCode) : false;
- }
- if (e.constructor?.name === 'FetchError' && e.type === 'system') {
- return true;
- }
- return false;
-}
function isUserError(e) {
if (isErrorWithAnalytics(e)) {
return e.getAttributes().isUserError ?? false;
}
- if (isLikelyNetworkError(e)) {
- return true;
+ if (e.constructor?.name === 'FetchError') {
+ if (e.type === 'system') {
+ return true;
+ }
}
return false;
}
function getErrorAttributes(e) {