重构异常打印的方式

This commit is contained in:
季圣华
2019-09-05 18:20:12 +08:00
parent 59156e5f74
commit 083c870950
26 changed files with 439 additions and 1541 deletions

View File

@@ -0,0 +1,27 @@
package com.jsh.erp.exception;
import com.jsh.erp.constants.ExceptionConstants;
import org.slf4j.Logger;
/**
* 封装日志打印,收集日志
* author: ji shenghua, qq 752718 920
*/
public class JshException {
public static void readFail(Logger logger, Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
public static void writeFail(Logger logger, Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
}