You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core/src/shared/errors.ts
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -788,7 +788,7 @@ export function isNetworkError(err?: unknown): err is Error & { code: string } {
788
788
if(
789
789
isVSCodeProxyError(err)||
790
790
isSocketTimeoutError(err)||
791
-
isNonJsonHttpResponse(err)||
791
+
isHttpSyntaxError(err)||
792
792
isEnoentError(err)||
793
793
isEaccesError(err)||
794
794
isEbadfError(err)||
@@ -849,11 +849,13 @@ function isSocketTimeoutError(err: Error): boolean {
849
849
/**
850
850
* Expected JSON response from HTTP request, but got an error HTML error page instead.
851
851
*
852
-
* Example error message:
853
-
* "Unexpected token '<', "<html><bod"... is not valid JSON Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object."
852
+
* IMPORTANT:
853
+
*
854
+
* This function is influenced by {@link getReasonFromSyntaxError()} since it modifies the error
855
+
* message with the real underlying reason, instead of the default "Unexpected token" message.
* While the contents of the response may contain sensitive information, there may be a reason
891
893
* for failure embedded. This function attempts to extract that reason.
892
894
*
895
+
* Example error message before extracting:
896
+
* "Unexpected token '<', "<html><bod"... is not valid JSON Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object."
897
+
*
893
898
* If the reason cannot be found or the error is not a SyntaxError, return undefined.
0 commit comments