Interface GroovyshOptions.ErrorHandler

Enclosing class:
GroovyshOptions
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface GroovyshOptions.ErrorHandler
Handles an error thrown by the REPL loop.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handle(Throwable error, Consumer<Throwable> defaultTrace)
    Handles an error that escaped command execution.
  • Method Details

    • handle

      void handle(Throwable error, Consumer<Throwable> defaultTrace)
      Handles an error that escaped command execution. UserInterruptException and EndOfFileException are not delivered here; Main treats those as control flow. A handler that throws is not caught again: the error escapes the REPL loop and Main.start(GroovyshOptions, String[]) returns 1.
      Parameters:
      error - the thrown error or exception
      defaultTrace - groovysh's own renderer, for a handler that wants to delegate