Skip to content

Commit 29a216c

Browse files
committed
chore: use optional catch binding
1 parent 3e3a674 commit 29a216c

13 files changed

Lines changed: 21 additions & 21 deletions

File tree

certification/runner/api.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class API {
3030

3131
try {
3232
assert.equal(response.status, 200);
33-
} catch (_err) {
33+
} catch {
3434
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
3535
}
3636

@@ -58,7 +58,7 @@ class API {
5858

5959
try {
6060
assert.equal(response.status, 201);
61-
} catch (_err) {
61+
} catch {
6262
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
6363
}
6464

@@ -81,7 +81,7 @@ class API {
8181

8282
try {
8383
assert.equal(response.status, 201);
84-
} catch (_err) {
84+
} catch {
8585
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
8686
}
8787

@@ -95,7 +95,7 @@ class API {
9595

9696
try {
9797
assert.equal(response.status, 200);
98-
} catch (_err) {
98+
} catch {
9999
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
100100
}
101101

@@ -109,7 +109,7 @@ class API {
109109

110110
try {
111111
assert.equal(response.status, 200);
112-
} catch (_err) {
112+
} catch {
113113
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
114114
}
115115

@@ -131,7 +131,7 @@ class API {
131131

132132
try {
133133
assert.equal(response.status, 200);
134-
} catch (_err) {
134+
} catch {
135135
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
136136
}
137137

lib/actions/authorization/check_claims.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default async function checkClaims(ctx, next) {
2828

2929
try {
3030
claims = JSON.parse(params.claims);
31-
} catch (_err) {
31+
} catch {
3232
throw new InvalidRequest('could not parse the claims parameter JSON');
3333
}
3434

lib/actions/authorization/ciba_load_account.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default async function cibaLoadAccount(ctx, next) {
1717

1818
try {
1919
({ 0: [mechanism, value], length } = Object.entries(mechanisms));
20-
} catch (_err) {}
20+
} catch {}
2121

2222
if (!length) {
2323
throw new InvalidRequest('missing one of required parameters login_hint_token, id_token_hint, or login_hint');

lib/helpers/oidc_context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export default function getContext(provider) {
233233

234234
try {
235235
({ 0: [mechanism, token], length } = Object.entries(mechanisms));
236-
} catch (_err) {}
236+
} catch {}
237237

238238
if (!length) {
239239
throw new NoAccessTokenProvided();

lib/helpers/pkce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function checkPKCE(verifier, challenge, method) {
2323
if (!constantEquals(challenge, expected)) {
2424
throw new Error();
2525
}
26-
} catch (_err) {
26+
} catch {
2727
throw new InvalidGrant('PKCE verification failed');
2828
}
2929
}

lib/models/base_model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default function getBaseModel(provider) {
100100
const payload = await this.verify(stored, { ignoreExpiration });
101101

102102
return this.instantiate(payload);
103-
} catch (_err) {
103+
} catch {
104104
return undefined;
105105
}
106106
}

lib/models/device_code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default (provider) => class DeviceCode extends apply([
2525
return undefined;
2626
}
2727
return this.instantiate(payload);
28-
} catch (_err) {
28+
} catch {
2929
return undefined;
3030
}
3131
}

lib/models/session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default (provider) => class Session extends hasFormat(provider, 'Session'
4444
try {
4545
const payload = await this.verify(stored);
4646
return this.instantiate(payload);
47-
} catch (_err) {
47+
} catch {
4848
return undefined;
4949
}
5050
}

lib/shared/check_rar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default async function checkRar(ctx, next) {
2121

2222
try {
2323
details = JSON.parse(params.authorization_details);
24-
} catch (_err) {
24+
} catch {
2525
throw new InvalidRequest('could not parse the authorization_details parameter JSON');
2626
}
2727

lib/shared/client_auth.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default function clientAuthentication(provider) {
105105
try {
106106
basicClientId = decodeAuthToken(basic.slice(0, i));
107107
clientSecret = decodeAuthToken(basic.slice(i + 1));
108-
} catch (_err) {
108+
} catch {
109109
throw new InvalidRequest('client_id and client_secret in the authorization header are not properly encoded');
110110
}
111111

@@ -120,7 +120,7 @@ export default function clientAuthentication(provider) {
120120
let sub;
121121
try {
122122
({ payload: { sub } } = JWT.decode(ctx.headers['oauth-client-attestation']));
123-
} catch (_err) {
123+
} catch {
124124
throw new InvalidRequest('invalid OAuth-Client-Attestation format');
125125
}
126126

@@ -134,7 +134,7 @@ export default function clientAuthentication(provider) {
134134
let sub;
135135
try {
136136
({ payload: { sub } } = JWT.decode(ctx.oidc.params.client_assertion));
137-
} catch (_err) {
137+
} catch {
138138
throw new InvalidRequest('invalid client_assertion format');
139139
}
140140

0 commit comments

Comments
 (0)