using DS.Module.Core.Log;
using DS.Module.Core;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
namespace DS.WMS.FeeBillRecvService
{
///
/// 全局异常错误日志
///
public class GlobalExceptionsFilter : IExceptionFilter
{
private readonly IHostingEnvironment _env;
private readonly IServiceProvider _serviceProvider;
public GlobalExceptionsFilter(IHostingEnvironment env, IServiceProvider serviceProvider)
{
_env = env;
_serviceProvider = serviceProvider;
}
public void OnException(ExceptionContext context)
{
var json = new JsonErrorResponse();
json.Message = context.Exception.Message; //错误信息
if (_env.IsDevelopment())
{
json.DevelopmentMessage = context.Exception.StackTrace; //堆栈信息
}
var result = DataResult