2、定义一个异常的枚举数组
- ServerErrCodeDefine类
//```java
@AllArgsConstructor
@Getter
public enum ServerErrCodeDefine {
private int errCode;
private String code;
private HttpStatus httpStatus;
private String messageSourceKey;
/*********************************************
* 启动错误 从5000开始
*********************************************/
SystemLoginEncryptNotEmpty(5000, "EncryptNotEmpty", HttpStatus.INTERNAL_SERVER_ERROR, "system.login.encrypt.empty"), fmuSystemLoginTokenNotEmpty(5001, "TokenNotEmpty", HttpStatus.INTERNAL_SERVER_ERROR, "system.login.token.empty"),
/*********************************************
* 认证操作异常码 从6000开始
*********************************************/
SecurityHeaderAuthorNotEmpty(6000, "AuthorNotEmpty", HttpStatus.UNAUTHORIZED, "security.header.author.empty"), fmuSecurityHeaderDateNotEmpty(6001, "DateNotEmpty", HttpStatus.BAD_REQUEST, "security.header.date.empty"), fmuSecurityInvalidHeaderValue(6002, "InvalidHeaderField", HttpStatus.UNAUTHORIZED, "security.header.value.invalid"), fmuSecurityInvalidAlgorithm(6003, "InvalidAlgorithmType", HttpStatus.BAD_REQUEST, "security.header.algorithm.invalid"), fmuSecurityInvalidUser(6004, "InvalidAccessKey", HttpStatus.FORBIDDEN, "security.header.user.invalid"), fmuSecurityTimeTooSkewed(6005, "TimeTooSkewed", HttpStatus.REQUEST_TIMEOUT, "security.request.timetooskewed"), fmuSecurityUnsupportedEncoding(6006, "UnsupportedEncoding", HttpStatus.UNAUTHORIZED, "security.unsupported.encoding"), fmuSecurityUnsupportedAlgorithm(6007, "UnsupportedAlgorithm", HttpStatus.UNAUTHORIZED, "security.unsupported.algorithm"), fmuSecurityUnauthorized(6008, "Unauthorized", HttpStatus.UNAUTHORIZED, "security.unauthorized"), fmuSecurityContentTypeNotEmpty(6009, "ContentTypeNotEmpty", HttpStatus.UNAUTHORIZED, "security.header.contenttype.empty"), fmuSystemNoVisitPriviledge(6010, "NoVisitPriviledge", HttpStatus.NOT_ACCEPTABLE, "system.no.visit.priviledge"), fmuSystemSubscribeCostomSendFailed(6011, "VslServerFailed", HttpStatus.SERVICE_UNAVAILABLE, "request.to.vsl.server.failed"), fmuSystemVslReturnDataErr(6012, "VslReturnDataErr", HttpStatus.SERVICE_UNAVAILABLE, "system.vsl.return.data.error"),
}