Skip to content

Commit 3f1d5d1

Browse files
committed
ref: Avoid try-catch with unused parameter
Instead, we can just use the parameter-less version of try-catch. In future versions of eslint, this will be disallowed, so extracting this out.
1 parent fa210ad commit 3f1d5d1

File tree

38 files changed

+61
-61
lines changed

38 files changed

+61
-61
lines changed

dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function getApproximateNumberOfTests(testPath: string): number {
131131
const content = fs.readFileSync(path.join(process.cwd(), testPath, 'test.ts'), 'utf-8');
132132
const matches = content.match(/sentryTest\(/g);
133133
return Math.max(matches ? matches.length : 1, 1);
134-
} catch (e) {
134+
} catch {
135135
console.error(`Could not read file ${testPath}`);
136136
return 1;
137137
}

dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Sentry.init({
1414
moduleMetadataEntries.push(frame.module_metadata);
1515
});
1616
});
17-
} catch (e) {
17+
} catch {
1818
// noop
1919
}
2020
}

dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Sentry.init({
2828
moduleMetadataEntries.push(frame.module_metadata);
2929
});
3030
});
31-
} catch (e) {
31+
} catch {
3232
// noop
3333
}
3434
}

dev-packages/browser-integration-tests/utils/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const envelopeParser = (request: Request | null): unknown[] => {
2323
return envelope.split('\n').map(line => {
2424
try {
2525
return JSON.parse(line);
26-
} catch (error) {
26+
} catch {
2727
return line;
2828
}
2929
});
@@ -172,7 +172,7 @@ export async function runScriptInSandbox(
172172
): Promise<void> {
173173
try {
174174
await page.addScriptTag({ path: impl.path, content: impl.content });
175-
} catch (e) {
175+
} catch {
176176
// no-op
177177
}
178178
}

dev-packages/e2e-tests/test-applications/ember-classic/app/controllers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class IndexController extends Controller {
2222
public createCaughtEmberError(): void {
2323
try {
2424
throw new Error('Looks like you have a caught EmberError');
25-
} catch (e) {
25+
} catch {
2626
// do nothing
2727
}
2828
}

packages/browser/src/eventbuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function parseStackFrames(
120120

121121
try {
122122
return stackParser(stacktrace, skipLines, framesToPop);
123-
} catch (e) {
123+
} catch {
124124
// no-empty
125125
}
126126

@@ -392,7 +392,7 @@ function getObjectClassName(obj: unknown): string | undefined | void {
392392
try {
393393
const prototype: Prototype | null = Object.getPrototypeOf(obj);
394394
return prototype ? prototype.constructor.name : undefined;
395-
} catch (e) {
395+
} catch {
396396
// ignore errors here
397397
}
398398
}

packages/browser/src/tracing/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export function shouldAttachHeaders(
277277
try {
278278
resolvedUrl = new URL(targetUrl, href);
279279
currentOrigin = new URL(href).origin;
280-
} catch (e) {
280+
} catch {
281281
return false;
282282
}
283283

@@ -413,7 +413,7 @@ function setHeaderOnXhr(
413413
xhr.setRequestHeader!('baggage', sentryBaggageHeader);
414414
}
415415
}
416-
} catch (_) {
416+
} catch {
417417
// Error: InvalidStateError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.
418418
}
419419
}

packages/browser/src/transports/offline.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ function createIndexedDbStore(options: BrowserOfflineTransportOptions): OfflineS
129129
try {
130130
const serialized = await serializeEnvelope(env);
131131
await push(getStore(), serialized, options.maxQueueSize || 30);
132-
} catch (_) {
132+
} catch {
133133
//
134134
}
135135
},
136136
unshift: async (env: Envelope) => {
137137
try {
138138
const serialized = await serializeEnvelope(env);
139139
await unshift(getStore(), serialized, options.maxQueueSize || 30);
140-
} catch (_) {
140+
} catch {
141141
//
142142
}
143143
},
@@ -147,7 +147,7 @@ function createIndexedDbStore(options: BrowserOfflineTransportOptions): OfflineS
147147
if (deserialized) {
148148
return parseEnvelope(deserialized);
149149
}
150-
} catch (_) {
150+
} catch {
151151
//
152152
}
153153

packages/cloudflare/src/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
233233
}
234234

235235
// This is here because Miniflare sometimes cannot get instrumented
236-
} catch (e) {
236+
} catch {
237237
// Do not console anything here, we don't want to spam the console with errors
238238
}
239239

packages/core/src/instrument/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async function resolveResponse(res: Response | undefined, onFinishedResolving: (
172172
onFinishedResolving();
173173
readingActive = false;
174174
}
175-
} catch (error) {
175+
} catch {
176176
readingActive = false;
177177
} finally {
178178
clearTimeout(chunkTimeout);

0 commit comments

Comments
 (0)