Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/mailer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ export class MailerService {

private verifyTransporter(transporter: Transporter, name?: string): void {
const transporterName = name ? ` '${name}'` : '';
transporter.verify()
.then(() => this.mailerLogger.debug(`Transporter${transporterName} is ready`))
.catch((error) => this.mailerLogger.error(`Error occurred while verifying the transporter${transporterName}: ${error.message}`));

// wrap value in a promise to ensure then is always defined
new Promise(()=>transporter?.verify())
.then(() => this.mailerLogger.log(`Transporter${transporterName} is ready`))
.catch((error) => this.mailerLogger.log(`Error occurred while verifying the transporter${transporterName}}: ${error.message}`));
Comment on lines +111 to +112

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the log level (debug/error -> log)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the point here is to just wrap it in a promise and keep the default behavior

}

public async verifyAllTransporters() {
Expand Down