packagecom.mlq.exception;importcom.mlq.tools.ErrorPrintUtils;public abstract class AbstractException extendsRuntimeException {private static final long serialVersionUID = -5992753399315247713L;privateString errorCode;privateString errorMsg;privateString stackTraceMsg;privateString level;privateString messageID;private boolean sendMsg = true;publicAbstractException(String code, String message, String... level) {super(code + "|" +message);this.handleExceptionMessage(code, message, code + "|" +message);
}publicAbstractException(String code, String message, Throwable th) {super(code + "|" +message, th);this.handleExceptionMessage(code, message, ErrorPrintUtils.printStackTrace(th));
}public final voidhandleExceptionMessage(String code, String message, String stackTraceMsg) {this.errorCode =code;this.errorMsg =message;this.stackTraceMsg =stackTraceMsg;
}publicAbstractException(Throwable cause) {super(cause);
AbstractException.ErrorDesc errorDesc= this.getErrorDesc(cause);if (errorDesc != null) {this.errorCode =errorDesc.errorCode;this.errorMsg =errorDesc.errorMsg;
}
}publicAbstractException(String message) {super(message);
}public abstractAbstractException.ErrorDesc getErrorDesc(Throwable var1);publicString getErrorCode() {return this.errorCode;
}publicString getErrorMsg() {return this.errorMsg;
}public voidsetErrorCode(String errorCode) {this.errorCode =errorCode;
}public voidsetErrorMsg(String errorMsg) {this.errorMsg =errorMsg;
}publicString getStackTraceMsg() {return this.stackTraceMsg;
}public voidsetStackTraceMsg(String stackTraceMsg) {this.stackTraceMsg =stackTraceMsg;
}publicString getLevel() {return this.level;
}public voidsetLevel(String level) {this.level =level;
}publicString getMessageID() {return this.messageID;
}public voidsetMessageID(String messageID) {this.messageID =messageID;
}public booleanisSendMsg() {return this.sendMsg;
}public void setSendMsg(booleansendMsg) {this.sendMsg =sendMsg;
}public static classErrorDesc {publicString errorCode;publicString errorMsg;publicErrorDesc(String errorCode, String errorMsg) {this.errorCode =errorCode;this.errorMsg =errorMsg;
}
}
}