package com.dpkj.common.exception; import lombok.Getter; /** * 错误返回枚举类 */ @Getter public enum ErrorEnum implements ErrorInterface{ // ========================================================================== /** * 成功范围 * @code 200 * @apiNote 访问成功 */ SUCCESS(200, "访问成功"), /** * 系统异常 * @code 500 * @apiNote 系统异常 */ FAIL(500, "系统异常"), /** * 所有的空指针异常 * @code 10002 * @apiNote 填写信息为空 */ NULL_POINTER_EXCEPTION(501, "填写信息为空"), /** * 运行时异常, * @code 10003 * @apiNote 系统发生错误,请联系管理员 */ RUNTIME_EXCEPTION(502, "系统发生错误,请联系管理员"), /** * Http传入的参数没有可以读的数据 * @code 10004 * @apiNote 传入的数据不可读 */ HTTP_MESSAGE_NOT_READABLE_EXCEPTION(503, "传入的数据不可读"), // ========================================================================== ; private final Integer code; private final String message; ErrorEnum(Integer code, String message){ this.message = message; this.code = code; } @Override public int getCode(){ return this.code; } @Override public String getMessage(){ return this.message; } }