Class Error

All Implemented Interfaces:
Future<Void>, Associator, Eligible
Direct Known Subclasses:
HandlingError, HostUnresolved, IOError, JsonParsingError

public class Error extends Event<Void>
This event signals that an error occurred while processing an event.
  • Constructor Details

    • Error

      public Error(Error event)
      Creates a new event as a copy of an existing event.

      Useful for forwarding an event. Constructors “<T extend Error> T(T event)” must be implemented by all derived classes.

      Parameters:
      event - the event to copy
    • Error

      public Error(Event<?> event, String message)
      Creates a new event.
      Parameters:
      event - the event being processed when the problem occurred
      message - the message
    • Error

      public Error(Event<?> event, String message, Throwable throwable)
      Creates a new event caused by the given throwable.
      Parameters:
      event - the event being processed when the problem occurred
      message - the message
      throwable - the throwable
    • Error

      public Error(Event<?> event, Throwable throwable)
      Creates a new event caused by the given throwable.

      The message is initialized from the throwable.

      Parameters:
      event - the event being processed when the problem occurred
      throwable - the throwable
  • Method Details

    • duplicate

      public static <T extends Error> T duplicate(T event)
      Duplicate the event.

      Returns a new event with the same class and the same properties of the given event. Relies on the proper implementation of constructors “<T extend Error> T(T event)” for derived classes.

      Creating a duplicate id useful for forwarding a derived Error while handling a base class.

      Type Parameters:
      T - the generic type
      Parameters:
      event - the event
      Returns:
      the t
    • event

      public Event<?> event()
      Returns the event that was handled when the problem occurred.
      Returns:
      the event
    • message

      public String message()
      Returns the message passed to the constructor.
      Returns:
      the message
    • throwable

      public Throwable throwable()
      Returns the throwable that caused the problem.
      Returns:
      the throwable or null if the problem wasn’t caused by a throwable.
    • toString

      public String toString()
      Overrides:
      toString in class Event<Void>