Benutzerdefinierte Fehlerseiten für die Statuscodes 404 und 500 im HomeController hinzugefügt, um verschiedene Benutzerfälle zu behandeln.
This commit is contained in:
@@ -19,5 +19,7 @@ namespace EnvelopeGenerator.Application.Contracts
|
||||
Task<IServiceResult<bool>> VerifyAccessCodeAsync(string uuid, string signature, string accessCode);
|
||||
|
||||
Task<IServiceResult<bool>> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode);
|
||||
|
||||
Task<IServiceResult<bool>> IsExisting(string envelopeReceiverId);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum EnvelopeFlag
|
||||
{
|
||||
EnvelopeOrReceiverNonexists
|
||||
EnvelopeOrReceiverNonexists,
|
||||
NonDecodableEnvelopeReceiverId
|
||||
}
|
||||
}
|
||||
@@ -6,19 +6,20 @@ namespace EnvelopeGenerator.Application
|
||||
{
|
||||
public static class EnvelopeGeneratorExtensions
|
||||
{
|
||||
public static void LogEnvelopeError(this ILogger logger, string receiverId, string? message, params object?[] args)
|
||||
public static void LogEnvelopeError(this ILogger logger, string envelopeEeceiverId, Exception? exception = null, string? message = null, params object?[] args)
|
||||
{
|
||||
(string? envelopeUuid, string? receiverSignature) = receiverId.DecodeEnvelopeReceiverId();
|
||||
|
||||
var sb = new StringBuilder($"Envelope Uuid: {envelopeUuid}\nReceiver Signature: {receiverSignature}");
|
||||
var sb = new StringBuilder(envelopeEeceiverId.DecodeEnvelopeReceiverId().ToTitle());
|
||||
|
||||
if (message is not null)
|
||||
sb.AppendLine().Append(message);
|
||||
|
||||
logger.Log(LogLevel.Error, sb.ToString(), args);
|
||||
if(exception is null)
|
||||
logger.Log(LogLevel.Error, sb.ToString(), args);
|
||||
else
|
||||
logger.Log(LogLevel.Error, exception, sb.ToString(), args);
|
||||
}
|
||||
|
||||
public static void LogEnvelopeError(this ILogger logger, string uuid, string? signature = null, string? message = null, params object?[] args)
|
||||
public static void LogEnvelopeError(this ILogger logger, string? uuid, string? signature = null, Exception? exception = null, string? message = null, params object?[] args)
|
||||
{
|
||||
var sb = new StringBuilder($"Envelope Uuid: {uuid}");
|
||||
|
||||
@@ -28,7 +29,10 @@ namespace EnvelopeGenerator.Application
|
||||
if (message is not null)
|
||||
sb.AppendLine().Append(message);
|
||||
|
||||
logger.Log(LogLevel.Error, sb.ToString(), args);
|
||||
if (exception is null)
|
||||
logger.Log(LogLevel.Error, sb.ToString(), args);
|
||||
else
|
||||
logger.Log(LogLevel.Error, exception, sb.ToString(), args);
|
||||
}
|
||||
|
||||
public static string ToTitle(this (string? UUID, string? Signature) envelopeReceiverTuple)
|
||||
|
||||
@@ -95,5 +95,16 @@ namespace EnvelopeGenerator.Application.Services
|
||||
|
||||
return await VerifyAccessCodeAsync(uuid: uuid, signature: signature, accessCode: accessCode);
|
||||
}
|
||||
|
||||
public async Task<IServiceResult<bool>> IsExisting(string envelopeReceiverId)
|
||||
{
|
||||
(string? uuid, string? signature) = envelopeReceiverId.DecodeEnvelopeReceiverId();
|
||||
|
||||
if (uuid is null || signature is null)
|
||||
return Failed(false).WithFlag(EnvelopeFlag.NonDecodableEnvelopeReceiverId);
|
||||
|
||||
int count = await _repository.CountAsync(uuid:uuid, signature:signature);
|
||||
return Successful(count > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user