Commit 71bc51e9 authored by yanzg's avatar yanzg

修改代码

parent 62c255b7
package com.yanzuoguang.util; package com.yanzuoguang.util;
import com.yanzuoguang.util.exception.CodeException; import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.exception.CodeTargetException;
import com.yanzuoguang.util.exception.RuntimeCodeException; import com.yanzuoguang.util.exception.RuntimeCodeException;
import com.yanzuoguang.util.helper.JsonHelper; import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
...@@ -63,6 +64,34 @@ public class YzgErrorData { ...@@ -63,6 +64,34 @@ public class YzgErrorData {
} }
} }
/**
* 抛出异常
*
* @param code 错误码
* @param target 携带对象
* @param args 异常数据
*/
public CodeTargetException getCodeTargetException(String code, Object target, Object... args) {
return getCodeTargetException(null, target, code, args);
}
/**
* 抛出异常
*
* @param ex 上级错误
* @param code 错误码
* @param target 携带对象
* @param args 异常数据
*/
public CodeTargetException getCodeTargetException(Throwable ex, String code, Object target, Object... args) {
String message = getMessage(ErrorCode, code, args);
if (ex != null) {
return new CodeTargetException(TAG + code, message, target, ex);
} else {
return new CodeTargetException(TAG + code, message, target);
}
}
/** /**
* 抛出异常 * 抛出异常
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment