Mercurial Hosting > nabble
view src/nabble/view/lib/NabbleErrorFilter.java @ 62:4674ed7d56df default tip
remove n2
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 30 Sep 2023 20:25:29 -0600 |
parents | 7ecd1a4ef557 |
children |
line wrap: on
line source
package nabble.view.lib; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; public class NabbleErrorFilter implements Filter { public static final String WORK_AROUND_ERROR_EXCEPTION = "work-around.error.exception"; public void destroy() { } public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { try { chain.doFilter(req, res); } catch(Exception e) { req.setAttribute(WORK_AROUND_ERROR_EXCEPTION, e); if(e instanceof RuntimeException) { RuntimeException th = (RuntimeException)e; throw th; } else if(e instanceof IOException) { IOException th = (IOException)e; throw th; } else { ServletException th = (ServletException)e; if( MinorServletException.isIn(th) ) throw new IOException(th); throw th; } } } public void init(FilterConfig arg0) throws ServletException { } }