chore: add 2fa
This commit is contained in:
@@ -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"));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user