Interface ThrowablePrinter

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 interface ThrowablePrinter
Strategy interface responsible for printing throwables that are caught but not otherwise handled.

This allows platforms to customise how unhandled exceptions are presented, whether by logging frameworks, plain printing, or other mechanisms.

  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull ThrowablePrinter
    box()
    Returns a printer that formats the throwable into a decorative box and logs it using the IMPERAT logger.
    void
    print(@NotNull Throwable throwable)
    Prints the stacktrace for the given throwable.
    static @NotNull ThrowablePrinter
    Returns a simple printer that logs the throwable using the IMPERAT logger.
  • Method Details

    • simple

      @NotNull static @NotNull ThrowablePrinter simple()
      Returns a simple printer that logs the throwable using the IMPERAT logger.
      Returns:
      a basic throwable printer
    • box

      @NotNull static @NotNull ThrowablePrinter box()
      Returns a printer that formats the throwable into a decorative box and logs it using the IMPERAT logger.
      Returns:
      a boxed throwable printer
    • print

      void print(@NotNull @NotNull Throwable throwable)
      Prints the stacktrace for the given throwable.
      Parameters:
      throwable - the throwable to print