Closed tqwewe closed 1 year ago
I think this is something that can't and won't be fixed. If an actor's handler returns an error, it's going to kill (terminate) the actor. This is signifying some abnormal processing for the actor. If there's a pending RPC going on, then the sender will be dropped with the cleanup of the actor, which is why you get a SenderError
response (since the async awaiter is no longer valid).
There's no underlying monitoring framework, outside of supervision, saying something like "This actor is dying with some error, reply to any pending RPC with this specific error". That would require some support for things like reflection probably to be able to (a) identify that there's a pending RPC and (b) propagate that information from the actor's task/thread to the caller's task/thread.
Thanks for the response!
Is your feature request related to a problem? Please describe. If a message handler fails when calling
.call
on an actor,CallResult::SenderError
is returned with no error information.Describe the solution you'd like
CallResult::Failed(err)
should be added to theCallResult
enum containing if an error occured when handling the message.Ideally, I'd be able to write the following code:
Describe alternatives you've considered Using a
RpcReplyPort<Result<T, E>>
to send the error back. However this makes it difficult to work with, as I cannot use the?
operator to simply return the error.