refactor: error logging

This commit is contained in:
Polianin Nikita 2024-10-27 04:36:20 +03:00
parent 6c20713d81
commit 8fad070a9c

View File

@ -56,7 +56,7 @@ public class CustomExceptionHandlerMiddleware(RequestDelegate next, ILogger<Cust
if (code == StatusCodes.Status500InternalServerError) if (code == StatusCodes.Status500InternalServerError)
{ {
error = "Internal Server Error"; error = "Internal Server Error";
logger.LogError("Internal server error: {Message}\nStackTrace:\n{StackTrace}", exception.Message, exception.StackTrace); logger.LogError(exception, "Internal server error when processing the request");
} }
else else
error = exception.Message; error = exception.Message;