Class StatusReply.Error$

java.lang.Object
org.apache.pekko.pattern.StatusReply.Error$
Enclosing class:
StatusReply<T>

public static class StatusReply.Error$ extends Object
Scala API for creating and pattern matching an error response

For example: case StatusReply.Error(exception) => ...

  • Field Details

    • MODULE$

      public static final StatusReply.Error$ MODULE$
      Static reference to the singleton instance of this Scala object.
  • Constructor Details

    • Error$

      public Error$()
  • Method Details

    • apply

      public <T> StatusReply<T> apply(String errorMessage)
      Scala API: Create an status response with a error message describing why the request was failed or denied.
    • apply

      public <T> StatusReply<T> apply(Throwable exception)
      Scala API: Create an error response with a user defined Throwable.

      Prefer the string based error response over this one when possible to avoid tightly coupled logic across actors and passing internal failure details on to callers that can not do much to handle them.

      For cases where types are needed to identify errors and behave differently enumerating them with a specific set of response messages may be a better alternative to encoding them as generic exceptions.

      Also note that Pekko does not contain pre-build serializers for arbitrary exceptions.

    • unapply

      public scala.Option<Throwable> unapply(StatusReply<?> status)