This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-argus-service/src/main/java/com/nis/restful/RestServiceException.java

84 lines
1.9 KiB
Java
Raw Normal View History

2017-12-19 14:55:52 +08:00
package com.nis.restful;
import org.springframework.util.StringUtils;
import com.nis.web.service.SaveRequestLogThread;
public class RestServiceException extends RuntimeException{
private int errorCode;
private int logSource;
2017-12-19 14:55:52 +08:00
private String traceCode;
2017-12-19 14:55:52 +08:00
/**
*
*/
private static final long serialVersionUID = -4854901217206974677L;
public RestServiceException(){
}
// public RestServiceException(String message) {
// super(message);
// this.errorCode = 998; //未知错误
// }
public RestServiceException(SaveRequestLogThread thread,long time,String message) {
super(message);
this.errorCode = 998; //未知错误
this.traceCode = thread.getTraceCode();
2017-12-19 14:55:52 +08:00
thread.setConsumerTime(time);
thread.setBusinessCode(this.getErrorCode());
if(StringUtils.isEmpty(thread.getExceptionInfo())) {
thread.setExceptionInfo(message);
}
2017-12-19 14:55:52 +08:00
new Thread(thread).start();
}
public RestServiceException(String message,int errorCode) {
super(message);
this.errorCode = errorCode;
}
public RestServiceException(SaveRequestLogThread thread,long time,String message,int errorCode) {
super(message);
this.errorCode = errorCode;
this.traceCode = thread.getTraceCode();
2017-12-19 14:55:52 +08:00
thread.setConsumerTime(time);
thread.setBusinessCode(this.getErrorCode());
if(StringUtils.isEmpty(thread.getExceptionInfo())) {
thread.setExceptionInfo(message);
}
2017-12-19 14:55:52 +08:00
new Thread(thread).start();
}
public int getErrorCode() {
return errorCode;
}
public void setErrorCode(int errorCode) {
this.errorCode = errorCode;
}
public int getLogSource() {
return logSource;
}
public void setLogSource(int logSource) {
this.logSource = logSource;
}
2017-12-19 14:55:52 +08:00
public String getTraceCode() {
return traceCode;
}
public void setTraceCode(String traceCode) {
this.traceCode = traceCode;
}
2017-12-19 14:55:52 +08:00
}