【8.0】【event】更新报错信息的打印

pull/57/head
fengshuonan 2023-07-14 17:13:10 +08:00
parent 255fb40162
commit 8b37874ebf
2 changed files with 14 additions and 3 deletions

View File

@ -41,7 +41,12 @@ public enum EventExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
CANT_FIND_EVENT(RuleConstants.BUSINESS_ERROR_TYPE_CODE + EventConstants.EVENT_EXCEPTION_STEP_CODE + "01", "查询不到对应业务事件,具体信息:{}");
CANT_FIND_EVENT(RuleConstants.BUSINESS_ERROR_TYPE_CODE + EventConstants.EVENT_EXCEPTION_STEP_CODE + "01", "查询不到对应业务事件,具体信息:{}"),
/**
*
*/
ERROR_INVOKE(RuleConstants.BUSINESS_ERROR_TYPE_CODE + EventConstants.EVENT_EXCEPTION_STEP_CODE + "02", "事件调用,方法调用失败");
/**
*

View File

@ -2,8 +2,11 @@ package cn.stylefeng.roses.kernel.event.sdk.publish;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.stylefeng.roses.kernel.event.api.exception.enums.EventExceptionEnum;
import cn.stylefeng.roses.kernel.event.sdk.container.EventContainer;
import cn.stylefeng.roses.kernel.event.sdk.pojo.BusinessListenerDetail;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -15,6 +18,7 @@ import java.util.List;
* @author fengshuonan
* @since 2023/7/14 16:21
*/
@Slf4j
public class BusinessEventPublisher {
/**
@ -54,7 +58,8 @@ public class BusinessEventPublisher {
try {
listenerMethod.invoke(businessObject);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
log.error("方法调用失败,反射调用异常", e);
throw new ServiceException(EventExceptionEnum.ERROR_INVOKE);
}
}
@ -66,7 +71,8 @@ public class BusinessEventPublisher {
try {
listenerMethod.invoke(bean, businessObject);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
log.error("方法调用失败,反射调用异常", e);
throw new ServiceException(EventExceptionEnum.ERROR_INVOKE);
}
}
}