From 46cef1c6c7b0f8945673da7b1b4ddae1f7f0a534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 20 Jul 2026 18:03:27 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=86=85=E9=83=A8=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8B=A6=E6=88=AA=20=E8=BF=94=E5=9B=9E=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E6=A0=87=E5=87=86=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/FlowExceptionHandler.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/handler/FlowExceptionHandler.java diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/handler/FlowExceptionHandler.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/handler/FlowExceptionHandler.java new file mode 100644 index 000000000..837298704 --- /dev/null +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/handler/FlowExceptionHandler.java @@ -0,0 +1,33 @@ +package org.dromara.workflow.handler; + +import jakarta.servlet.http.HttpServletRequest; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.domain.R; +import org.dromara.warm.flow.core.exception.FlowException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +/** + * 工作流失败异常 + * + * @author Lion Li + */ +@Slf4j +@RestControllerAdvice +public class FlowExceptionHandler { + + /** + * 工作流失败异常。 + * + * @param e 异常信息 + * @param request 当前请求 + * @return 统一失败响应 + */ + @ExceptionHandler(FlowException.class) + public R handleFlowException(FlowException e, HttpServletRequest request) { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}'", requestURI, e); + return R.fail(e.getMessage()); + } + +}