Commit e20d5b0b authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Fix uncorrectly used Logger

parent e1e9fa9d
Pipeline #2448 passed with stages
in 18 seconds
......@@ -112,7 +112,7 @@ export class EmailService {
try {
conn = await amqp.connect(rabbitmqUrl);
} catch (error) {
Logger.error('Error connecting to RabbitMQ', error, `${EmailService.name} - ${this.send.name}`);
this.logger.error('Error connecting to RabbitMQ', error, `${EmailService.name} - ${this.send.name}`);
throw new InternalServerErrorException('Could not connect to rabbitMQ.');
}
......@@ -120,7 +120,7 @@ export class EmailService {
// Create a communication channel
ch = await conn.createChannel();
} catch (error) {
Logger.error('Error creating channel', error, `${EmailService.name} - ${this.send.name}`);
this.logger.error('Error creating channel', error, `${EmailService.name} - ${this.send.name}`);
throw new InternalServerErrorException('Could not create channel.');
}
......@@ -130,18 +130,18 @@ export class EmailService {
try {
await ch.assertQueue(mailerQueue, { durable: true });
} catch (error) {
Logger.error('Error asserting queue', error, `${EmailService.name} - ${this.send.name}`);
this.logger.error('Error asserting queue', error, `${EmailService.name} - ${this.send.name}`);
throw new InternalServerErrorException('Could not assert queue.');
}
try {
await ch.sendToQueue(mailerQueue, buffer, { persistent: true });
} catch (error) {
Logger.error('Error sending to queue', error, `${EmailService.name} - ${this.send.name}`);
this.logger.error('Error sending to queue', error, `${EmailService.name} - ${this.send.name}`);
throw new InternalServerErrorException('Could not send to queue.');
}
Logger.log(
this.logger.log(
`Sent to queue ${mailerQueue},{ from: ${email.from}, to: ${email.to}, subject: ${email.subject}}`, `${EmailService.name} - ${this.send.name}`,
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment