mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -22,6 +22,8 @@ public class ExceptionExecutorImpl implements ExceptionExecutor {
|
||||
|
||||
private static final String CONSTRAINT_VIOLATION_EXCEPTION = "ConstraintViolationException";
|
||||
private static final String OPEN_EXCEPTION = "OpenException";
|
||||
private static final String BIZ_ERROR_REGEX = "<OPEN_ERROR>(.*?)</OPEN_ERROR>";
|
||||
static Pattern PATTERN = Pattern.compile(BIZ_ERROR_REGEX, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
|
||||
|
||||
@Override
|
||||
public ApiResponse executeException(ApiRequestContext apiRequestContext, Exception e) {
|
||||
@@ -36,7 +38,14 @@ public class ExceptionExecutorImpl implements ExceptionExecutor {
|
||||
}
|
||||
if (exceptionClass.contains(OPEN_EXCEPTION)) {
|
||||
String exceptionMessage = genericException.getExceptionMessage();
|
||||
String errorMsg = exceptionMessage.split("\n")[1];
|
||||
|
||||
Matcher matcher = PATTERN.matcher(exceptionMessage);
|
||||
String errorMsg;
|
||||
if (matcher.find()) {
|
||||
errorMsg = matcher.group(1);
|
||||
} else {
|
||||
errorMsg = "biz-error@@系统错误";
|
||||
}
|
||||
// isv.common-error@@系统错误@@
|
||||
String[] msgAr = errorMsg.split("@@");
|
||||
return ApiResponse.error(
|
||||
@@ -53,7 +62,7 @@ public class ExceptionExecutorImpl implements ExceptionExecutor {
|
||||
}
|
||||
|
||||
private static Set<String> findErrorMsg(String text) {
|
||||
Pattern pattern = Pattern.compile("'([^']*)'");
|
||||
Pattern pattern = java.util.regex.Pattern.compile("'([^']*)'");
|
||||
Matcher matcher = pattern.matcher(text);
|
||||
Set<String> msgList = new LinkedHashSet<>();
|
||||
while (matcher.find()) {
|
||||
|
Reference in New Issue
Block a user