Skip to content

Commit

Permalink
🌐 Adjust the log when a transporter is successfully verified with a '…
Browse files Browse the repository at this point in the history
…debug log.' Also, add a function that returns a boolean indicating if all transporters are verified as true.
  • Loading branch information
AlexandreT-DevId committed Feb 27, 2024
1 parent 0286362 commit d6480e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/mailer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ export class MailerService {
private verifyTransporter(transporter: Transporter, name?: string): void {
const transporterName = name ? ` '${name}'` : '';
transporter.verify()
.then(() => this.mailerLogger.error(`Transporter${transporterName} is ready`))

This comment has been minimized.

Copy link
@uchechiukpa

uchechiukpa Mar 6, 2024

why use error?
error will indicate that an error occurred which is not the case, this is to show a successful connection.

This comment has been minimized.

Copy link
@GFoniX

GFoniX Mar 6, 2024

I've made a mistake and fixed it at #1121.
I now use .debug() (although I could also use .log()).

This comment has been minimized.

Copy link
@uchechiukpa

uchechiukpa Mar 6, 2024

yeah I think log will be the best

This comment has been minimized.

Copy link
@jaequery

jaequery Mar 10, 2024

has this been released?

.catch((error) => this.mailerLogger.error(`Error occurred while verifying the transporter${transporterName}}: ${error.message}`));
.then(() => this.mailerLogger.debug(`Transporter${transporterName} is ready`))
.catch((error) => this.mailerLogger.error(`Error occurred while verifying the transporter${transporterName}: ${error.message}`));
}

public async verifyAllTransporters() {
const transporters = [...this.transporters.values(), this.transporter];
const transportersVerified = await Promise.all(transporters.map(transporter => transporter.verify().catch(() => false)));
return transportersVerified.every(verified => verified);
}

public async sendMail(
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"Eduardo Leal <eduardolleal@icloud.com>",
"Juan Echeverry <e.juandav@gmail.com>",
"Paweł Partyka <partyka95@icloud.com>",
"Alexandre TITEUX <alexandretiteux@gmail.com>",
"Yanarp"
],
"scripts": {
Expand Down

0 comments on commit d6480e3

Please sign in to comment.