Skip to content

Commit

Permalink
refactor(repeater): improve error messages (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk committed Oct 4, 2023
1 parent 20652dd commit 2bec238
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Repeater/ServerRepeaterLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Helpers, logger } from '../Utils';
import { CliInfo } from '../Config';
import { RepeaterCommandHub } from './RepeaterCommandHub';
import { delay, inject, injectable } from 'tsyringe';
import chalk from 'chalk';

@injectable()
export class ServerRepeaterLauncher implements RepeaterLauncher {
Expand Down Expand Up @@ -123,7 +124,7 @@ export class ServerRepeaterLauncher implements RepeaterLauncher {
);
});
this.repeaterServer.errorOccurred(({ message }) => {
logger.error(message);
logger.error(`%s: %s`, chalk.red('(!) CRITICAL'), message);
});
this.repeaterServer.reconnectionFailed((payload) =>
this.reconnectionFailed(payload)
Expand All @@ -139,15 +140,16 @@ export class ServerRepeaterLauncher implements RepeaterLauncher {
);
this.repeaterServer.upgradeAvailable((payload) =>
logger.warn(
'A new Repeater version (%s) is available, please update Bright CLI',
'%s: A new Repeater version (%s) is available, for update instruction visit https://docs.brightsec.com/docs/installation-options',
chalk.yellow('(!) IMPORTANT'),
payload.version
)
);
this.repeaterServer.reconnectionAttempted(({ attempt, maxAttempts }) =>
logger.warn('Failed to connect (attempt %d/%d)', attempt, maxAttempts)
);
this.repeaterServer.reconnectionSucceeded(() =>
logger.log('Repeater connected')
logger.log('The Repeater (%s) connected', this.info.version)
);
}

Expand Down

0 comments on commit 2bec238

Please sign in to comment.