代码优化

This commit is contained in:
thinkgem
2024-04-01 11:51:19 +08:00
parent 53af15f85d
commit 7ccbb05b7b

View File

@@ -5,11 +5,11 @@
*/ */
package com.jeesite.common.lang; package com.jeesite.common.lang;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import javax.servlet.http.HttpServletRequest;
/** /**
* 关于异常的工具类. * 关于异常的工具类.
* @author calvin * @author calvin
@@ -26,8 +26,8 @@ public class ExceptionUtils {
Throwable ex = null; Throwable ex = null;
if (request.getAttribute("exception") != null) { if (request.getAttribute("exception") != null) {
ex = (Throwable) request.getAttribute("exception"); ex = (Throwable) request.getAttribute("exception");
} else if (request.getAttribute("javax.servlet.error.exception") != null) { } else if (request.getAttribute(RequestDispatcher.ERROR_EXCEPTION) != null) {
ex = (Throwable) request.getAttribute("javax.servlet.error.exception"); ex = (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
} }
return ex; return ex;
} }