docs: @Deprecated
      public static void handleThrowable(FacesContext facesContext, Throwable ex) throws FacesException
      {
          _prepareExceptionStack(ex);
  
          boolean errorPageWritten = false;
  
          // check if an error page is present in web.xml
          // if so, do not generate an error page
          //WebXml webXml = WebXml.getWebXml(facesContext.getExternalContext());
          //if (webXml.isErrorPagePresent())
          WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebConfigProviderFactory(
                  facesContext.getExternalContext()).getWebConfigProvider(facesContext.getExternalContext());
  
          if(webConfigProvider.isErrorPagePresent(facesContext.getExternalContext()))
          {
              // save current view in the request map to access it on the error page
              facesContext.getExternalContext().getRequestMap().put(VIEW_KEY, facesContext.getViewRoot());
          }
          else
          {
              // check for org.apache.myfaces.ERROR_HANDLING
              // do not generate an error page if it is false
              String errorHandling = facesContext.getExternalContext().getInitParameter(ERROR_HANDLING_PARAMETER);
              boolean errorHandlingDisabled = (errorHandling != null && errorHandling.equalsIgnoreCase("false"));
              if (!errorHandlingDisabled)
              {
                  // write the error page
                  Object response = facesContext.getExternalContext().getResponse();
                  if (response instanceof HttpServletResponse)
                  {
                      HttpServletResponse httpResp = (HttpServletResponse) response;
                      if (!httpResp.isCommitted())
                      {
                          httpResp.reset();
                          if (facesContext.getPartialViewContext().isAjaxRequest())
                          {
                              // ajax request --> xml error page 
                              httpResp.setContentType("text/xml; charset=UTF-8");
                              try
                              {
                                  Writer writer = httpResp.getWriter();
                                  // can't use facesContext.getResponseWriter(), because it might not have been set
                                  ResponseWriter responseWriter = new HtmlResponseWriterImpl(writer, "text/xml", "utf-8");
                                  PartialResponseWriter partialWriter = new PartialResponseWriter(responseWriter);
                                  partialWriter.startDocument();
                                  partialWriter.startError(ex.getClass().getName());
                                  if (ex.getCause() != null)
                                  {
                                      partialWriter.write(ex.getCause().toString());
                                  }
                                  else if (ex.getMessage() != null)
                                  {
                                      partialWriter.write(ex.getMessage());
                                  }
                                  partialWriter.endError();
                                  partialWriter.endDocument();
                              }
                              catch(IOException ioe)
                              {
                                  throw new FacesException("Could not write the error page", ioe);
                              }
                          }
                          else
                          {
                              // normal request --> html error page
                              httpResp.setContentType("text/html; charset=UTF-8");
                              try
                              {
                                  Writer writer = httpResp.getWriter();
                                  debugHtml(writer, facesContext, ex);
                              }
                              catch(IOException ioe)
                              {
                                  throw new FacesException("Could not write the error page", ioe);
                              }
                          }
                          log.log(Level.SEVERE, "An exception occurred", ex);
  
                          // mark the response as complete
                          facesContext.responseComplete();
  
                          errorPageWritten = true;
                      }
                  }
              }
          }
  
          // rethrow the throwable, if we did not write the error page
          if (!errorPageWritten)
          {
              if (ex instanceof FacesException)
              {
                  throw (FacesException) ex;
              }
              if (ex instanceof RuntimeException)
              {
                  throw (RuntimeException) ex;
              }
              throw new FacesException(ex);
          }
  
      }