using HuanMeng.DotNetCore.Base;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
namespace HuanMeng.DotNetCore.MiddlewareExtend
{
///
/// 异常中间件
///
public class ExceptionMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger _logger;
public ExceptionMiddleware(RequestDelegate next, ILogger logger)
{
_next = next;
_logger = logger;
}
public async Task Invoke(HttpContext context)
{
try
{
await _next(context);
}
catch (ArgumentNullException ex)
{
context.Response.StatusCode = StatusCodes.Status200OK;
BaseResponse