Interface UnwrappableThrowable

All Superinterfaces:
Serializable
All Known Implementing Classes:
UnwrappableException, UnwrappableRuntimeException

public interface UnwrappableThrowable extends Serializable
This base-level exception interface is used to add some additional methods to Throwables which may prove useful for compressing large stack-traces. Rather than showing all the individual code line traces, we can just print the tree of exception names and TOP-level messages; allowing for a more digestible output. But optionally still provide the ability to ask for it all.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Provide a default implementation with basic output in the form of a single string.
    default String
    unwrapReasons(boolean includeTrace)
    A method to return the nested stack of exceptions, but give the option to include the stack traces to the caller.
    default List<String>
    Provide a default implementation with basic output in the form of a List of strings, with an element for each exception in the tree of issues.
    unwrapReasonsIntoList(boolean includeTrace)
    The implementation of this method should provide a list, where each element in the list represents one Exception in the tree of causes.
  • Method Details

    • unwrapReasons

      default String unwrapReasons()
      Provide a default implementation with basic output in the form of a single string. The output from this method should NOT contain the stack-traces, only the top level exception listing.
      Returns:
      A string with all nested Exception reasons compressed into a single string.
    • unwrapReasons

      default String unwrapReasons(boolean includeTrace)
      A method to return the nested stack of exceptions, but give the option to include the stack traces to the caller.
      Parameters:
      includeTrace - Used to determine whether we should include the stack trace in the message or not.
      Returns:
      A single string with all nested Exception reasons compressed into a single string, which MAY have the stack trace present.
    • unwrapReasonsIntoList

      default List<String> unwrapReasonsIntoList()
      Provide a default implementation with basic output in the form of a List of strings, with an element for each exception in the tree of issues. The output from this method should NOT contain the stack-traces, only the top level exception listings.
      Returns:
      A collection of Strings, where each element represents one Exception in the tree of causes.
    • unwrapReasonsIntoList

      List<String> unwrapReasonsIntoList(boolean includeTrace)
      The implementation of this method should provide a list, where each element in the list represents one Exception in the tree of causes. A caller may also use the parameter to ask for the causes to include their respective stack traces. This may either be in-line to one string in the list, or it may explode them out into their own distinct entries.
      Parameters:
      includeTrace - Used to determine whether we should include the stack trace in the messages or not.
      Returns:
      A collection of Strings, where each element represents one Exception in the tree of causes, which may contain the stack traces that each exception originated from.