Rename InsertObjectFailedException.Request to Procedure
Updated ExceptionHandlingMiddleware to use the new Procedure property name when logging InsertObjectFailedException. Changed error title for BadRequestException to "Bad Procedure". Removed unused System.Text.Json using directive from InsertObjectProcedure.cs.
This commit is contained in:
@@ -66,7 +66,7 @@ public class ExceptionHandlingMiddleware
|
||||
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||
details = new()
|
||||
{
|
||||
Title = "Bad Request",
|
||||
Title = "Bad Procedure",
|
||||
Detail = badRequestEx.Message
|
||||
};
|
||||
break;
|
||||
@@ -109,9 +109,9 @@ public class ExceptionHandlingMiddleware
|
||||
case InsertObjectFailedException insertFailedEx:
|
||||
logger.LogError(
|
||||
insertFailedEx,
|
||||
"Insert operation failed during request processing. {request}",
|
||||
"Insert operation failed during request processing. {procedure}",
|
||||
JsonSerializer.Serialize(
|
||||
insertFailedEx.Request,
|
||||
insertFailedEx.Procedure,
|
||||
options: new() { WriteIndented = true }
|
||||
));
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@ namespace ReC.Application.Common.Exceptions;
|
||||
|
||||
public class InsertObjectFailedException : Exception
|
||||
{
|
||||
public InsertObjectProcedure Request { get; }
|
||||
public InsertObjectProcedure Procedure { get; }
|
||||
|
||||
public InsertObjectFailedException(InsertObjectProcedure request) : base()
|
||||
public InsertObjectFailedException(InsertObjectProcedure procedure) : base()
|
||||
{
|
||||
Request = request;
|
||||
Procedure = procedure;
|
||||
}
|
||||
|
||||
public InsertObjectFailedException(InsertObjectProcedure request, string? message) : base(message)
|
||||
public InsertObjectFailedException(InsertObjectProcedure procedure, string? message) : base(message)
|
||||
{
|
||||
Request = request;
|
||||
Procedure = procedure;
|
||||
}
|
||||
|
||||
public InsertObjectFailedException(InsertObjectProcedure request, string? message, Exception? innerException) : base(message, innerException)
|
||||
public InsertObjectFailedException(InsertObjectProcedure procedure, string? message, Exception? innerException) : base(message, innerException)
|
||||
{
|
||||
Request = request;
|
||||
Procedure = procedure;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
using MediatR;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using ReC.Application.Common.Exceptions;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ReC.Application.Common.Procedures.InsertProcedure;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user