If I create my own exception object/class/type, e.g.
case object MyError extends Throwable
case class MyOtherError(msg: String) extends Throwable("the other error")
And then send these errors in a clustered system that has java-serialization disabled and uses custom serializers:
val ex1 = MyError
val ex2 = MyOtherError("user not found")
actorRef1 ! StatusReply.error(ex)
actorRef2 ! StatusReply.error(ex2)
Will my custom errors fail to be serialized? Or is the built in serializer for StatusReply able to serialize MyError and MyOtherError?
I see that in the StatusReply.error api it says: “Also note that Akka does not contain pre-build serializers for arbitrary exceptions.”
But I also see in the generic response wrapper documentation it says “Akka includes pre-built serializers for the type, so in the normal use case a clustered application only needs to provide a serializer for the successful result.” (my emphasis).
So would this work or would I need to define and link custom serializers for MyError and MyOtherError?