title: Why can't global exception handling handle exceptions thrown in the filter?
body: <p>Why can't global exception handling handle exceptions thrown in the filter?</p>
  <p>My code is looking like this at the moment:</p>
  <ol>
  <li><p>Filter method</p>
  <pre><code> @Override
   public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
       HttpServletRequest   httpServletRequest = (HttpServletRequest) servletRequest;
       String token = httpServletRequest.getHeader(&quot;token&quot;);
       if (token==null)
           throw new NoTokenException();
  
       try {
           String s = jwtToken.parseJwt(token);
           httpServletRequest.setAttribute(&quot;id&quot;,s);
       }catch (Exception e){
           throw new RuntimeException();
       }
  
       filterChain.doFilter(servletRequest,servletResponse);
   }
  </code></pre>
  </li>
  <li><p>Controller advice class</p>
  <pre><code> @RestControllerAdvice
   public class GlobalExceptionHandle {
  
       @ExceptionHandler(Exception.class)
       public void Handle(Exception e, HttpServletResponse response) throws IOException {
           response.setContentType(&quot;application/json;charset=UTF-8&quot;);
           response.getWriter().write(&quot;msg&quot;);
           response.flushBuffer();
       }
   }
  </code></pre>
  </li>
  </ol>