【问题标题】:Trying to catch exception in order to see request (HttpRequestMethodNotSupportedException)试图捕获异常以查看请求 (HttpRequestMethodNotSupportedException)
【发布时间】: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


【解决方案1】:

答案由@M 提供。迪南:

因为 DispatcherServlet 本身正在处理异常。从 透视滤镜也不例外。

【讨论】:

    猜你喜欢
    • 2014-01-20
    • 1970-01-01
    • 2013-12-10
    • 1970-01-01
    • 1970-01-01
    • 2019-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多