GlobalException.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //package com.config.exception;
  2. //
  3. //import com.auth0.jwt.exceptions.InvalidClaimException;
  4. //import org.apache.ibatis.binding.BindingException;
  5. //import org.springframework.web.bind.annotation.ControllerAdvice;
  6. //import org.springframework.web.bind.annotation.ExceptionHandler;
  7. //import org.springframework.web.bind.annotation.ResponseBody;
  8. //
  9. //import javax.management.OperationsException;
  10. //import java.util.HashMap;
  11. //import java.util.Map;
  12. //
  13. //@ControllerAdvice
  14. //public class GlobalException {
  15. // @ExceptionHandler(RuntimeException.class)
  16. // @ResponseBody
  17. // public Map<String, Object> exceptionHandle(){
  18. // Map<String, Object> result = new HashMap<String, Object>();
  19. // result.put("code" , "-502");
  20. // result.put("msg" , "服务器异常");
  21. // return result;
  22. // }
  23. //
  24. // @ExceptionHandler(OperationsException.class)
  25. // @ResponseBody
  26. // public Map<String, Object> operationsException(){
  27. // Map<String, Object> result = new HashMap<String, Object>();
  28. // result.put("code" , "-503");
  29. // result.put("msg", "权限不足");
  30. // return result;
  31. // }
  32. //
  33. //
  34. // @ExceptionHandler(BindingException.class)
  35. // @ResponseBody
  36. // public Map<String, Object> BindingException(){
  37. // Map<String, Object> result = new HashMap<String, Object>();
  38. // result.put("code" , "-504");
  39. // result.put("msg" , "数据为空");
  40. // return result;
  41. // }
  42. //
  43. // @ExceptionHandler(InvalidClaimException.class)
  44. // @ResponseBody
  45. // public Map<String, Object> InvalidClaimException(){
  46. // Map<String, Object> result = new HashMap<String, Object>();
  47. // result.put("code" , "-505");
  48. // result.put("msg" , "token过期");
  49. // return result;
  50. // }
  51. //
  52. //}