code: private void findErrorMessages(FacesContext context) {
          if (context.getMessageList().isEmpty() || context.isValidationFailed()) {
              return;
          }
          for (FacesMessage msg : context.getMessageList()) {
              if (msg.getSeverity().equals(FacesMessage.SEVERITY_ERROR) || msg.getSeverity().equals(FacesMessage.SEVERITY_FATAL)) {
                  validationFailed(context);
                  break;
              }
          }
      }
docs: If there is any faces message queued add PrimeFaces validation failed
  
  @param context