fix(server): http error parsing on endpoints without a default response (#12927)

This commit is contained in:
Jason Rasmussen
2024-09-25 12:05:03 -04:00
committed by GitHub
parent 8d515adac5
commit 005528ab5e
13 changed files with 162 additions and 18 deletions
+5 -7
View File
@@ -1,4 +1,4 @@
import { HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common';
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { DEFAULT_EXTERNAL_DOMAIN } from 'src/constants';
import { SystemConfigCore } from 'src/cores/system-config.core';
import { OnEmit } from 'src/decorators';
@@ -140,7 +140,7 @@ export class NotificationService {
try {
await this.notificationRepository.verifySmtp(dto.transport);
} catch (error) {
throw new HttpException('Failed to verify SMTP configuration', HttpStatus.BAD_REQUEST, { cause: error });
throw new BadRequestException('Failed to verify SMTP configuration', { cause: error });
}
const { server } = await this.configCore.getConfig({ withCache: false });
@@ -152,7 +152,7 @@ export class NotificationService {
},
});
await this.notificationRepository.sendEmail({
const { messageId } = await this.notificationRepository.sendEmail({
to: user.email,
subject: 'Test email from Immich',
html,
@@ -161,6 +161,8 @@ export class NotificationService {
replyTo: dto.replyTo || dto.from,
smtp: dto.transport,
});
return { messageId };
}
async handleUserSignup({ id, tempPassword }: INotifySignupJob) {
@@ -312,10 +314,6 @@ export class NotificationService {
imageAttachments: data.imageAttachments,
});
if (!response) {
return JobStatus.FAILED;
}
this.logger.log(`Sent mail with id: ${response.messageId} status: ${response.response}`);
return JobStatus.SUCCESS;