diff --git a/EnvelopeGenerator.Application/PdfSigning/SignPdfByEnvelopeCommand.cs b/EnvelopeGenerator.Application/PdfSigning/SignPdfByEnvelopeCommand.cs index e94298c3..3ce35e81 100644 --- a/EnvelopeGenerator.Application/PdfSigning/SignPdfByEnvelopeCommand.cs +++ b/EnvelopeGenerator.Application/PdfSigning/SignPdfByEnvelopeCommand.cs @@ -2,6 +2,7 @@ using DigitalData.Core.Exceptions; using EnvelopeGenerator.Application.Common.Query; using EnvelopeGenerator.Domain.Entities; +using EnvelopeGenerator.Domain.Exceptions; using MediatR; using Microsoft.EntityFrameworkCore; @@ -55,7 +56,7 @@ public class SignPdfByEnvelopeCommandHandler(IRepository Repo, ISender ?? throw new NotFoundException($"Envelope is not found ID: {request.Id} UUID: {request.Uuid}"); if (request.UserId is int userId && userId != envelope.UserId) - throw new UnauthorizedAccessException($"Envelope is not authorized for user with Id: {request.UserId} Envelope ID: {request.Id} UUID: {request.Uuid}"); + throw new AuthorizationException($"Envelope is not authorized for user with Id: {request.UserId} Envelope ID: {request.Id} UUID: {request.Uuid}"); if (envelope.EnvelopeReceivers.Count == 0) throw new NotFoundException($"Envelope has no receivers to sign ID: {request.Id} UUID: {request.Uuid}");