-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Version Information
Version 1.5.31
Describe the bug
If an actor tries to stash a lifecycle message (e.g. PreStart), the IllegalActorStateException is raised with the text "Can't stash the same message more than once". The text is supposed to include the actual message, but in case of PreStart current message is null, so no message information is included in the text. This is confusing because there is no attempt to stash a message twice, there is an attempt to stash a message that can't be stashed.
Expected behavior
Either InvalidOperationException should be raised, or the text for IllegalActorStateException should state that such message can't be stashed.
Actual behavior
IllegalActorStateException is raised with the text "Can't stash the same message more than once".
Additional context
In case a lifecycle message is being stashed, the currMessage is null, and both _currentEnvelopeId and _actorCell.CurrentEnvelopeId are zero (their equality triggers the exception). So there should be a check for nullable currMessage that should trigger either better exception text or InvalidOperationException.