mirror of https://gitee.com/stylefeng/roses
【8.0】【event】更新报错信息的打印
parent
255fb40162
commit
8b37874ebf
|
@ -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", "事件调用,方法调用失败");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误编码
|
* 错误编码
|
||||||
|
|
|
@ -2,8 +2,11 @@ package cn.stylefeng.roses.kernel.event.sdk.publish;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
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.container.EventContainer;
|
||||||
import cn.stylefeng.roses.kernel.event.sdk.pojo.BusinessListenerDetail;
|
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.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -15,6 +18,7 @@ import java.util.List;
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @since 2023/7/14 16:21
|
* @since 2023/7/14 16:21
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class BusinessEventPublisher {
|
public class BusinessEventPublisher {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +58,8 @@ public class BusinessEventPublisher {
|
||||||
try {
|
try {
|
||||||
listenerMethod.invoke(businessObject);
|
listenerMethod.invoke(businessObject);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} 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 {
|
try {
|
||||||
listenerMethod.invoke(bean, businessObject);
|
listenerMethod.invoke(bean, businessObject);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
throw new RuntimeException(e);
|
log.error("方法调用失败,反射调用异常", e);
|
||||||
|
throw new ServiceException(EventExceptionEnum.ERROR_INVOKE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue