-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌐 Adjust the log when a transporter is successfully verified with a '…
…debug log.' Also, add a function that returns a boolean indicating if all transporters are verified as true.
- Loading branch information
1 parent
0286362
commit d6480e3
Showing
2 changed files
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
GFoniX
|
||
.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( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
why use error?
error will indicate that an error occurred which is not the case, this is to show a successful connection.