refactored exceptions

This commit is contained in:
2024-08-26 11:29:57 +03:00
parent d009181b91
commit a9b9ae839c
3 changed files with 0 additions and 16 deletions

View File

@@ -1,7 +0,0 @@
using ApplicationLayer.GeneralExceptions;
using ApplicationLayer.Services.AuthServices.Requests;
namespace ApplicationLayer.Services.AuthServices.RegisterService.Exceptions
{
public class UserAlreadyExistsException(RegisterRequest request) : AlreadyExistsException($"User with email '{request.AuthData.Email}' already exists");
}

View File

@@ -1,7 +0,0 @@
using ApplicationLayer.GeneralExceptions;
namespace ApplicationLayer.Services.GeneralExceptions
{
/// Exception to throw when can't complete some action on entity(delete or something) because it's needed for other entities
public class EntityUsedInDatabaseException(string message) : ApiException(message);
}

View File

@@ -79,11 +79,9 @@ public class VisaApplicationRequestsHandler(
var application = await applications.GetByIdAsync(applicationId, cancellationToken); var application = await applications.GetByIdAsync(applicationId, cancellationToken);
if (application.Status != ApplicationStatus.Pending) if (application.Status != ApplicationStatus.Pending)
{ {
//todo refactor exceptions
throw new ApplicationAlreadyProcessedException(); throw new ApplicationAlreadyProcessedException();
} }
//todo handle exception or not
ApplicationStatus statusToSet = status switch ApplicationStatus statusToSet = status switch
{ {
AuthorityRequestStatuses.Approved => ApplicationStatus.Approved, AuthorityRequestStatuses.Approved => ApplicationStatus.Approved,