Package akka.pattern

Class StatusReply.Error$

  • Enclosing class:
    StatusReply<T>

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

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

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static StatusReply.Error$ MODULE$
      Static reference to the singleton instance of this Scala object.
    • Constructor Summary

      Constructors 
      Constructor Description
      Error$()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> StatusReply<T> apply​(java.lang.String errorMessage)
      Scala API: Create an status response with a error message describing why the request was failed or denied.
      <T> StatusReply<T> apply​(java.lang.Throwable exception)
      Scala API: Create an error response with a user defined Throwable.
      scala.Option<java.lang.Throwable> unapply​(StatusReply<?> status)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE$

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

      • Error$

        public Error$()
    • Method Detail

      • apply

        public <T> StatusReply<T> apply​(java.lang.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​(java.lang.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 Akka does not contain pre-build serializers for arbitrary exceptions.

      • unapply

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