Skip to content

Commit 0cf8d04

Browse files
authored
only log max attempt when actually reached max attempts (#654)
1 parent 12ff5c9 commit 0cf8d04

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/robot/client.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,18 @@ export class RobotClient extends EventDispatcher implements Robot {
351351
// eslint-disable-next-line no-console
352352
console.debug('Reconnected successfully!');
353353
})
354-
.catch(() => {
354+
.catch((error) => {
355+
if (
356+
this.reconnectMaxAttempts !== undefined &&
357+
this.currentRetryAttempt >= this.reconnectMaxAttempts
358+
) {
359+
// eslint-disable-next-line no-console
360+
console.debug(`Reached max attempts: ${this.reconnectMaxAttempts}`);
361+
return;
362+
}
363+
355364
// eslint-disable-next-line no-console
356-
console.debug(`Reached max attempts: ${this.reconnectMaxAttempts}`);
365+
console.error(error);
357366
});
358367
}
359368

0 commit comments

Comments
 (0)