Skip to content

Commit fd2c1a8

Browse files
committed
fix: throw an error when the max attempt count is exceeded
1 parent 4e8110f commit fd2c1a8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/languageClient.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ export class LanguageClientManager implements LanguageClient {
141141
public async start (): Promise<void> {
142142
let started = false
143143
let attempt = 0
144+
const maxStartAttemptCount = this.managerOptions.maxStartAttemptCount
144145
while (
145146
!this.isDisposed() &&
146-
!started && (
147-
this.managerOptions.maxStartAttemptCount == null ||
148-
attempt < this.managerOptions.maxStartAttemptCount
149-
)
147+
!started
150148
) {
149+
if (maxStartAttemptCount != null && attempt >= maxStartAttemptCount) {
150+
throw new Error(`Max connection attempt count exceeded: ${maxStartAttemptCount}`)
151+
}
151152
try {
152153
this.startPromise = this._start()
153154
await this.startPromise

0 commit comments

Comments
 (0)