Unused error variables in catch block are not allowed (#24487)

This commit is contained in:
Alisa
2026-04-01 21:33:07 -07:00
committed by GitHub
parent 84936dc85d
commit 3344f6849c
92 changed files with 162 additions and 157 deletions
+5 -5
View File
@@ -159,7 +159,7 @@ export function parseGoogleApiError(error: unknown): GoogleApiError | null {
if (typeof errorObj === 'string') {
try {
errorObj = JSON.parse(sanitizeJsonString(errorObj));
} catch (_) {
} catch {
// Not a JSON string, can't parse.
return null;
}
@@ -200,7 +200,7 @@ export function parseGoogleApiError(error: unknown): GoogleApiError | null {
// The message is a JSON string, but not a nested error object.
break;
}
} catch (_error) {
} catch {
// It wasn't a JSON string, so we've drilled down as far as we can.
break;
}
@@ -284,7 +284,7 @@ function fromGaxiosError(errorObj: object): ErrorShape | undefined {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
data = JSON.parse(sanitizeJsonString(data));
} catch (_) {
} catch {
// Not a JSON string, can't parse.
}
}
@@ -334,7 +334,7 @@ function fromApiError(errorObj: object): ErrorShape | undefined {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
data = JSON.parse(sanitizeJsonString(data));
} catch (_) {
} catch {
// Not a JSON string, can't parse.
// Try one more fallback: look for the first '{' and last '}'
if (typeof data === 'string') {
@@ -346,7 +346,7 @@ function fromApiError(errorObj: object): ErrorShape | undefined {
data = JSON.parse(
sanitizeJsonString(data.substring(firstBrace, lastBrace + 1)),
);
} catch (__) {
} catch {
// Still failed
}
}