Handle the Exception when it is thrown in a Typed Actor

Hi All,

I like to catch and store the exception thrown in a typed actor.

I see 2 options here:

Behaviors.supervise(handler).onFailure(MySupervisorStrategy) -> having your own supervisor strategy that allows to decide what todo with failures (like storing)

Or Behaviors .receiveSignal(…)
using the Partial function to catch the exception and store it.

Somehow, the ChildFailed(ref, sig)) doesn’t get into my receiveSignal (I throw an IllegalArgumentException in a commandHandler, just for testing) and a custom SupervisorStrategy seems not an option for Typed Actors.

Any advice on how to move this forward ?

Kind regards,

Olger

Do you watch the child? Otherwise you will not receive ChildFailed.

ah, yes your are right.
It takes a bit to get used to the ‘structure’ of the behaviors coming from the classic actors.

Thanks for your patience,

Olger