code: protected String renderErrorPageToHTML(final WComponent errorPage) {
  
  		// Check if using the default error page
  		boolean defaultErrorPage = errorPage instanceof FatalErrorPage;
  
  		String html = null;
  
  		// If not default implementation of error page, Transform error page to HTML
  		if (!defaultErrorPage) {
  			// Set UIC and Environment (Needed for Theme Paths)
  			UIContext uic = new UIContextImpl();
  			uic.setEnvironment(createEnvironment());
  			UIContextHolder.pushContext(uic);
  			try {
  				html = WebUtilities.renderWithTransformToHTML(errorPage);
  			} catch (Exception e) {
  				LOG.warn("Could not transform error page.", e);
  			} finally {
  				UIContextHolder.popContext();
  			}
  		}
  
  		// Not transformed. So just render.
  		if (html == null) {
  			UIContextHolder.pushContext(new UIContextImpl());
  			try {
  				html = WebUtilities.render(errorPage);
  			} catch (Exception e) {
  				LOG.warn("Could not render error page.", e);
  				html = "System error occurred but could not render error page.";
  			} finally {
  				UIContextHolder.popContext();
  			}
  		}
  
  		return html;
  	}
docs: Render the error page component to HTML.
  
  @param errorPage the error page component
  @return the error page as HTML