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
+1 -1
View File
@@ -65,7 +65,7 @@ const getSavedChatTags = async (
);
return chatDetails;
} catch (_err) {
} catch {
return [];
}
};
@@ -198,7 +198,7 @@ export const directoryCommand: SlashCommand = {
alreadyAdded.push(trimmedPath);
continue;
}
} catch (_e) {
} catch {
// Path might not exist or be inaccessible.
// We'll let batchAddDirectories handle it later.
}
@@ -321,7 +321,7 @@ async function exploreAction(
});
try {
await open(extensionsUrl);
} catch (_error) {
} catch {
context.ui.addItem({
type: MessageType.ERROR,
text: `Failed to open browser. Check out the extensions gallery at ${extensionsUrl}`,
@@ -151,7 +151,7 @@ async function completion(
const files = await fs.readdir(checkpointDir);
const jsonFiles = files.filter((file) => file.endsWith('.json'));
return getTruncatedCheckpointNames(jsonFiles);
} catch (_err) {
} catch {
return [];
}
}
@@ -76,7 +76,7 @@ export async function updateGitignore(gitRepoRoot: string): Promise<void> {
let fileExists = true;
try {
existingContent = await fs.promises.readFile(gitignorePath, 'utf8');
} catch (_error) {
} catch {
// File doesn't exist
fileExists = false;
}
@@ -168,8 +168,8 @@ async function downloadFiles({
async function createDirectory(dirPath: string): Promise<void> {
try {
await fs.promises.mkdir(dirPath, { recursive: true });
} catch (_error) {
debugLogger.debug(`Failed to create ${dirPath} directory:`, _error);
} catch (error) {
debugLogger.debug(`Failed to create ${dirPath} directory:`, error);
throw new Error(
`Unable to create ${dirPath} directory. Do you have file permissions in the current directory?`,
);
@@ -222,8 +222,8 @@ export const setupGithubCommand: SlashCommand = {
let gitRepoRoot: string;
try {
gitRepoRoot = getGitRepoRoot();
} catch (_error) {
debugLogger.debug(`Failed to get git repo root:`, _error);
} catch (error) {
debugLogger.debug(`Failed to get git repo root:`, error);
throw new Error(
'Unable to determine the GitHub repository. /setup-github must be run from a git repository.',
);
@@ -450,7 +450,7 @@ function* emitKeys(
insertable: true,
sequence: decoded,
});
} catch (_e) {
} catch {
debugLogger.log('Failed to decode OSC 52 clipboard data');
}
}
+1 -1
View File
@@ -319,7 +319,7 @@ export function useAtCompletion(props: UseAtCompletionProps): void {
if (state.pattern !== null) {
dispatch({ type: 'SEARCH', payload: state.pattern });
}
} catch (_) {
} catch {
if (initEpoch.current === currentEpoch) {
dispatch({ type: 'ERROR' });
}
@@ -51,7 +51,7 @@ describe('useConsoleMessages', () => {
for (const unmount of unmounts) {
try {
unmount();
} catch (_e) {
} catch {
// Ignore unmount errors
}
}
@@ -161,7 +161,7 @@ describe('useErrorCount', () => {
for (const unmount of unmounts) {
try {
unmount();
} catch (_e) {
} catch {
// Ignore unmount errors
}
}
+1 -1
View File
@@ -102,7 +102,7 @@ export const useFolderTrust = (
try {
await trustedFolders.setValue(cwd, trustLevel);
} catch (_e) {
} catch {
coreEvents.emitFeedback(
'error',
'Failed to save trust settings. Exiting Gemini CLI.',
@@ -31,7 +31,7 @@ export function useGitBranchName(cwd: string): string | undefined {
);
setBranchName(hashStdout.toString().trim());
}
} catch (_error) {
} catch {
setBranchName(undefined);
}
}, [cwd, setBranchName]);
@@ -57,7 +57,7 @@ export function useGitBranchName(cwd: string): string | undefined {
fetchBranchName();
}
});
} catch (_watchError) {
} catch {
// Silently ignore watcher errors (e.g. permissions or file not existing),
// similar to how exec errors are handled.
// The branch name will simply not update automatically.
@@ -141,7 +141,7 @@ export const usePermissionsModifyTrust = (
const folders = loadTrustedFolders();
try {
await folders.setValue(cwd, trustLevel);
} catch (_e) {
} catch {
coreEvents.emitFeedback(
'error',
'Failed to save trust settings. Your changes may not persist.',
@@ -159,7 +159,7 @@ export const usePermissionsModifyTrust = (
try {
await folders.setValue(cwd, pendingTrustLevel);
return true;
} catch (_e) {
} catch {
coreEvents.emitFeedback(
'error',
'Failed to save trust settings. Your changes may not persist.',
+1 -1
View File
@@ -135,7 +135,7 @@ export function interpolateColor(
const gradient = tinygradient(color1, color2);
const color = gradient.rgbAt(factor);
return color.toHexString();
} catch (_e) {
} catch {
return color1;
}
}
+1 -1
View File
@@ -108,7 +108,7 @@ function highlightAndRenderLine(
const renderedNode = renderHastNode(getHighlightedLine(), theme, undefined);
return renderedNode !== null ? renderedNode : strippedLine;
} catch (_error) {
} catch {
return stripAnsi(line);
}
}
+1 -1
View File
@@ -135,7 +135,7 @@ export async function getDirectorySuggestions(
.sort()
.slice(0, MAX_SUGGESTIONS)
.map((name) => resultPrefix + name + userSep);
} catch (_) {
} catch {
return [];
}
}