code: private boolean handleEvent(SnippetEvent ste) {
          Snippet sn = ste.snippet();
          if (sn == null) {
              debug("Event with null key: %s", ste);
              return false;
          }
          List<Diag> diagnostics = state.diagnostics(sn).collect(toList());
          String source = sn.source();
          if (ste.causeSnippet() == null) {
              // main event
              for (Diag d : diagnostics) {
                  hardmsg(d.isError()? "jshell.msg.error" : "jshell.msg.warning");
                  List<String> disp = new ArrayList<>();
                  displayDiagnostics(source, d, disp);
                  disp.stream()
                          .forEach(l -> hard("%s", l));
              }
  
              if (ste.status() != Status.REJECTED) {
                  if (ste.exception() != null) {
                      if (ste.exception() instanceof EvalException) {
                          printEvalException((EvalException) ste.exception());
                          return true;
                      } else if (ste.exception() instanceof UnresolvedReferenceException) {
                          printUnresolvedException((UnresolvedReferenceException) ste.exception());
                      } else {
                          hard("Unexpected execution exception: %s", ste.exception());
                          return true;
                      }
                  } else {
                      new DisplayEvent(ste, FormatWhen.PRIMARY, ste.value(), diagnostics)
                              .displayDeclarationAndValue();
                  }
              } else {
                  if (diagnostics.isEmpty()) {
                      errormsg("jshell.err.failed");
                  }
                  return true;
              }
          } else {
              // Update
              if (sn instanceof DeclarationSnippet) {
                  List<Diag> other = errorsOnly(diagnostics);
  
                  // display update information
                  new DisplayEvent(ste, FormatWhen.UPDATE, ste.value(), other)
                          .displayDeclarationAndValue();
              }
          }
          return false;
      }
docs: Handle incoming snippet events -- return true on failure