Skip to content

Commit

Permalink
Simplify code a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurschreiber committed Sep 16, 2024
1 parent 069d254 commit 87e80b9
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2005,9 +2005,7 @@ class Connection extends EventEmitter {
signal: signal
});
} catch (err: any) {
if (signal.aborted) {
throw signal.reason;
}
signal.throwIfAborted();

Check warning on line 2008 in src/connection.ts

View check run for this annotation

Codecov / codecov/patch

src/connection.ts#L2008

Added line #L2008 was not covered by tests

throw new ConnectionError(err.message, 'EINSTLOOKUP', { cause: err });

Check warning on line 2010 in src/connection.ts

View check run for this annotation

Codecov / codecov/patch

src/connection.ts#L2010

Added line #L2010 was not covered by tests
}
Expand All @@ -2017,9 +2015,7 @@ class Connection extends EventEmitter {
try {
socket = await this.connectOnPort(port, this.config.options.multiSubnetFailover, signal, this.config.options.connector);
} catch (err: any) {
if (signal.aborted) {
throw signal.reason;
}
signal.throwIfAborted();

throw this.wrapSocketError(err);
}
Expand Down Expand Up @@ -3575,12 +3571,10 @@ class Connection extends EventEmitter {
signalAborted
]);
} catch (err) {
if (!signal.aborted) {
throw new AggregateError(
[new ConnectionError('Security token could not be authenticated or authorized.', 'EFEDAUTH'), err]);
}
signal.throwIfAborted();

Check warning on line 3574 in src/connection.ts

View check run for this annotation

Codecov / codecov/patch

src/connection.ts#L3574

Added line #L3574 was not covered by tests

throw err;
throw new AggregateError(
[new ConnectionError('Security token could not be authenticated or authorized.', 'EFEDAUTH'), err]);
}

// Type guard the token value so that it is never null.
Expand Down

0 comments on commit 87e80b9

Please sign in to comment.