You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
Java
60 lines
1.2 KiB
Java
/*
|
|
* 文 件 名: CustomException
|
|
* 版 权:
|
|
* 描 述: <描述>
|
|
* 修 改 人: RedName
|
|
* 修改时间: 2022/8/5
|
|
* 跟踪单号: <跟踪单号>
|
|
* 修改单号: <修改单号>
|
|
* 修改内容: <修改内容>
|
|
*/
|
|
package com.supervision.exception;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
/**
|
|
* <功能详细描述>
|
|
* 自定义异常
|
|
*
|
|
* @author ljt
|
|
* @version [版本号, 2022/8/5]
|
|
* @see [相关类/方法]
|
|
* @since [产品/模块版本]
|
|
*/
|
|
@Slf4j
|
|
public class HumanException extends RuntimeException {
|
|
|
|
/**
|
|
* 房间状态获取异常时,前端刷新房间,重新进入
|
|
*/
|
|
private static final Integer HUMAN_ERROR = 6001;
|
|
/**
|
|
* 异常编码
|
|
*/
|
|
private final Integer code;
|
|
|
|
/**
|
|
* 异常信息
|
|
*/
|
|
private final String message;
|
|
|
|
private HumanException(Integer code, String message) {
|
|
this.code = code;
|
|
this.message = message;
|
|
}
|
|
|
|
public static HumanException humanError(String message) {
|
|
return new HumanException(HUMAN_ERROR, message);
|
|
}
|
|
|
|
@Override
|
|
public String getMessage() {
|
|
return message;
|
|
}
|
|
|
|
public Integer getCode() {
|
|
return code;
|
|
}
|
|
}
|