protected void doFilterInternal()

in src/main/java/org/apache/fineract/cn/lang/config/ServiceExceptionFilter.java [39:56]


  protected void doFilterInternal(final HttpServletRequest request,
                                  final HttpServletResponse response,
                                  final FilterChain filterChain)
      throws ServletException, IOException {
    try {
      filterChain.doFilter(request, response);
    } catch (final NestedServletException ex) {
      if (ServiceException.class.isAssignableFrom(ex.getCause().getClass())) {
        @SuppressWarnings("ThrowableResultOfMethodCallIgnored") final ServiceException serviceException = ServiceException.class.cast(ex.getCause());
        final ServiceError serviceError = serviceException.serviceError();
        logger.info("Responding with a service error " + serviceError);
        response.sendError(serviceError.getCode(), serviceError.getMessage());
      } else {
        logger.info("Unexpected exception caught " + ex);
        throw ex;
      }
    }
  }