柯桥增值式服务
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

58 lignes
1.1KB

  1. package com.ningdatech.kqapi.common.exception;
  2. /**
  3. * 运行期异常基类
  4. *
  5. * @author WendyYang
  6. * @version 1.0
  7. */
  8. public abstract class BaseCheckedException extends Exception implements BaseException {
  9. private static final long serialVersionUID = 2706069899924648586L;
  10. /**
  11. * 异常信息
  12. */
  13. private String message;
  14. /**
  15. * 具体异常码
  16. */
  17. private int code;
  18. public BaseCheckedException(final int code, final String message) {
  19. super(message);
  20. this.code = code;
  21. this.message = message;
  22. }
  23. public BaseCheckedException(final int code, final String format, Object... args) {
  24. super(String.format(format, args));
  25. this.code = code;
  26. this.message = String.format(format, args);
  27. }
  28. /**
  29. * 获取 异常消息
  30. *
  31. * @return 异常消息
  32. */
  33. @Override
  34. public String getMessage() {
  35. return message;
  36. }
  37. /**
  38. * 获取 错误码
  39. *
  40. * @return 错误码
  41. */
  42. @Override
  43. public int getCode() {
  44. return code;
  45. }
  46. }