package com.santos.iost.Exception;

import com.santos.iost.dto.Result;
import org.aspectj.lang.ProceedingJoinPoint;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class GlobalExceptionHandler {

    /*索斯异常*/
    @ResponseBody
    @ExceptionHandler(SoSsRequestException.class)
    public Result soSsRequestException(HttpServletRequest req, SoSsRequestException e)
    {
   /*     Result r=new Result();
        r.setResult(e.getResult());*/
        return Result.fail(e.getMessage(),e.getResult(),e.getCode());
    }
//    /*索斯异常*/
//    @ResponseBody
//    @ExceptionHandler(RuntimeException.class)
//    public Result RuntimeException(HttpServletRequest req, RuntimeException e)
//    {
//   /*     Result r=new Result();
//        r.setResult(e.getResult());*/
//        return Result.fail(e.getMessage(),e.get,e.getCode());
//    }
}
