chore: add 2fa

This commit is contained in:
mahyargdz
2025-07-27 10:24:23 +03:30
parent cfc05d89b6
commit 7cee095149
10 changed files with 411 additions and 84 deletions
@@ -3,6 +3,7 @@ import { Observable } from "rxjs";
import { catchError, map, throwError } from "rxjs";
import { WildDuckBaseService } from "./wildduck-base.service";
import * as MailServerExceptions from "../../../core/exceptions/mail-server.exceptions";
import { MailServerException } from "../../../core/exceptions/mail-server.exceptions";
import { ListMessagesQueryDto, SearchMessagesMailServerQueryDto, UpdateMessageDto, UploadMessageDto } from "../DTO/message.dto";
import { AttachmentResponse } from "../interfaces/attachment.interface";
@@ -101,10 +102,14 @@ export class WildDuckMessagesService extends WildDuckBaseService {
this.logger.error(`WildDuck API error: ${error.message}`, error.stack);
if (error.response?.data?.error) {
return throwError(() => new MailServerException(error.response.data.error));
return throwError(() => this.handleMailServerError(error.response.data.error, error.response.status));
}
return throwError(() => error);
if (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND") {
return throwError(() => new MailServerExceptions.MailServerConnectionException(error.message));
}
return throwError(() => new MailServerException(error.message || "Unknown mail server error"));
}),
);
}