code: func (vr *ValidationResult) OverallError(failOnWarnings bool) error {
  	errs, warns := 0, 0
  	for _, msg := range vr.Messages {
  		switch msg.Severity {
  		case "WARNING":
  			warns++
  		case "ERROR", "CRITICAL":
  			errs++
  		}
  	}
  
  	switch {
  	case errs > 0:
  		vr.Failed = true
  		return errors.Reason("some files were invalid").Err()
  	case warns > 0 && failOnWarnings:
  		vr.Failed = true
  		return errors.Reason("some files had validation warnings and -fail-on-warnings is set").Err()
  	case vr.RPCError != "":
  		vr.Failed = true
  		return errors.Reason("failed to send RPC to LUCI Config - %s", vr.RPCError).Err()
  	}
  
  	vr.Failed = false
  	return nil
  }
docs: // OverallError is nil if the validation succeeded or non-nil if failed.
  //
  // Beware: mutates Failed field accordingly.