Skip to content

Avoid specifying error type since the default is unknown #4086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/ql-vscode/scripts/source-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function extractSourceMap() {
resolve(sourceMapsDirectory, `${basename(file)}.map`),
);
rawSourceMaps.set(file, rawSourceMap);
} catch (e: unknown) {
} catch (e) {
// If the file is not found, we will not decode it and not try reading this source map again
if (e instanceof Error && "code" in e && e.code === "ENOENT") {
rawSourceMaps.set(file, null);
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/scripts/update-node-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async function updateNodeVersion() {

// If it exists, we can break out of this loop
break;
} catch (e: unknown) {
} catch (e) {
if (!isExecError(e)) {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/codeql-cli/distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class ExtensionSpecificDistributionManager {
const distributionStatePath = this.getDistributionStatePath();
try {
this.distributionState = await readJson(distributionStatePath);
} catch (e: unknown) {
} catch (e) {
if (isIOError(e) && e.code === "ENOENT") {
// If the file doesn't exist, that just means we need to create it

Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/common/short-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function expandShortPaths(

try {
return await expandShortPathNative(absoluteShortPath, logger);
} catch (e: unknown) {
} catch (e) {
void logger.log(
`Failed to expand short path using native method: ${getErrorMessage(e)}`,
);
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/databases/local-databases-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ export class DatabaseUI extends DisposableObject {
): Promise<void> {
try {
await this.chooseAndSetDatabase(false, progress);
} catch (e: unknown) {
} catch (e) {
void showAndLogExceptionWithTelemetry(
this.app.logger,
this.app.telemetry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export class DatabaseManager extends DisposableObject {
qlpackStoragePath,
);
await qlPackGenerator.generate();
} catch (e: unknown) {
} catch (e) {
void this.logger.log(
`Could not create skeleton QL pack: ${getErrorMessage(e)}`,
);
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/databases/ui/db-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export class DbPanel extends DisposableObject {
try {
// This will also validate that the controller repository is valid
await getControllerRepo(this.app.credentials);
} catch (e: unknown) {
} catch (e) {
if (e instanceof UserCancellationException) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ async function installOrUpdateThenTryActivate(

try {
await prepareCodeTour(app.commands);
} catch (e: unknown) {
} catch (e) {
void extLogger.log(
`Could not open tutorial workspace automatically: ${getErrorMessage(e)}`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class SkeletonQueryWizard {
// open the query file
try {
await this.openExampleFile();
} catch (e: unknown) {
} catch (e) {
void this.app.logger.log(
`Could not open example query file: ${getErrorMessage(e)}`,
);
Expand Down Expand Up @@ -279,7 +279,7 @@ export class SkeletonQueryWizard {
const qlPackGenerator = this.createQlPackGenerator();

await qlPackGenerator.generate();
} catch (e: unknown) {
} catch (e) {
void this.app.logger.log(
`Could not create skeleton QL pack: ${getErrorMessage(e)}`,
);
Expand All @@ -299,7 +299,7 @@ export class SkeletonQueryWizard {

this.fileName = await this.determineNextFileName();
await qlPackGenerator.createExampleQlFile(this.fileName);
} catch (e: unknown) {
} catch (e) {
void this.app.logger.log(
`Could not create query example file: ${getErrorMessage(e)}`,
);
Expand Down Expand Up @@ -342,7 +342,7 @@ export class SkeletonQueryWizard {
void withProgress(async (progress) => {
try {
await this.downloadDatabase(progress);
} catch (e: unknown) {
} catch (e) {
if (e instanceof UserCancellationException) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class SummaryLanguageSupport extends DisposableObject {
const sourceMapText = await readFile(mapPath, "utf-8");
const rawMap: RawSourceMap = JSON.parse(sourceMapText);
this.sourceMap = await new SourceMapConsumer(rawMap);
} catch (e: unknown) {
} catch (e) {
// Error reading sourcemap. Pretend there was no sourcemap.
void extLogger.log(
`Error reading sourcemap file '${mapPath}': ${getErrorMessage(e)}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function pickExtensionPack(
existingExtensionPackPaths[0],
databaseItem.language,
);
} catch (e: unknown) {
} catch (e) {
void showAndLogErrorMessage(
logger,
`Could not read extension pack ${formatPackName(packName)}`,
Expand Down
8 changes: 4 additions & 4 deletions extensions/ql-vscode/src/model-editor/model-editor-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export class ModelEditorView extends AbstractWebview<
this.app.logger,
);
this.modelingStore.setModeledMethods(this.databaseItem, modeledMethods);
} catch (e: unknown) {
} catch (e) {
void showAndLogErrorMessage(
this.app.logger,
`Unable to read data extension YAML: ${getErrorMessage(e)}`,
Expand Down Expand Up @@ -561,7 +561,7 @@ export class ModelEditorView extends AbstractWebview<
t: "setAccessPathSuggestions",
accessPathSuggestions: options,
});
} catch (e: unknown) {
} catch (e) {
void showAndLogExceptionWithTelemetry(
this.app.logger,
this.app.telemetry,
Expand Down Expand Up @@ -645,7 +645,7 @@ export class ModelEditorView extends AbstractWebview<
progress,
token: this.cancellationTokenSource.token,
});
} catch (e: unknown) {
} catch (e) {
void showAndLogExceptionWithTelemetry(
this.app.logger,
this.app.telemetry,
Expand Down Expand Up @@ -733,7 +733,7 @@ export class ModelEditorView extends AbstractWebview<
progress,
token: this.cancellationTokenSource.token,
});
} catch (e: unknown) {
} catch (e) {
void showAndLogExceptionWithTelemetry(
this.app.logger,
this.app.telemetry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export class VariantAnalysisManager
this.app.credentials,
variantAnalysisSubmission,
);
} catch (e: unknown) {
} catch (e) {
// If the error is handled by the handleRequestError function, we don't need to throw
if (
e instanceof RequestError &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("errorMessage", () => {
myRealFunction();

fail("Expected an error to be thrown");
} catch (e: unknown) {
} catch (e) {
if (!(e instanceof Error)) {
throw new Error("Expected an Error to be thrown");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { createMockVariantAnalysisConfig } from "../../../factories/config";
import { setupServer } from "msw/node";
import type { RequestHandler } from "msw";
import { http } from "msw";
import { getErrorMessage } from "../../../../src/common/helpers-pure";

// up to 3 minutes per test
jest.setTimeout(3 * 60 * 1000);
Expand Down Expand Up @@ -622,8 +623,8 @@ describe("Variant Analysis Manager", () => {
await variantAnalysisManager.cancelVariantAnalysis(
variantAnalysis.id + 100,
);
} catch (error: any) {
expect(error.message).toBe(
} catch (error) {
expect(getErrorMessage(error)).toBe(
`No variant analysis with id: ${variantAnalysis.id + 100}`,
);
}
Expand All @@ -637,8 +638,8 @@ describe("Variant Analysis Manager", () => {

try {
await variantAnalysisManager.cancelVariantAnalysis(variantAnalysis.id);
} catch (error: any) {
expect(error.message).toBe(
} catch (error) {
expect(getErrorMessage(error)).toBe(
`No workflow run id for variant analysis with id: ${variantAnalysis.id}`,
);
}
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy