【发布时间】:2017-01-20 18:16:08
【问题描述】:
我试图捕获一个异常,以便 evaluate 并查看前端的哪个 request 导致它。但是,我的断点从未被触发:
try{
filterChain.doFilter(request, response);
}catch(Exception e){
if(e instanceof org.springframework.web.HttpRequestMethodNotSupportedException)
throw new HttpRequestMethodNotSupportedException(e.getMessage());
throw new RuntimeException(e);
}
为什么我在 catch 语句中的断点永远不会执行?堆栈跟踪表示此特定方法是异常的来源。
【问题讨论】:
-
你的断点在哪里?
-
断点是@
if(e instanceof -
因为
DispatcherServlet本身正在处理异常。从过滤器的角度来看也不例外……
标签: spring exception request servlet-filters