I'm following the documentation (State Machine Error Handling) to implement error handling. However, when an exception occurs it is propagated up rather than intercepted. I tried using the interceptor, the listener and the @OnStateMachineError
without any success. Debugging the code, neither MethodInvokingStateMachineRuntimeProcessor.java:52
or any of its callers have any specific logic to handle errors.
Replicating the issue is simple, just create a state machine (I'm using the latest snapshot) and register the bean:
@WithStateMachine
public class ExceptionThrowingAction {
@OnTransition
public void throwError(@EventHeaders Map<String, Object> headers, ExtendedState extendedState) {
throw new RuntimeException("test error");
}
}
Am I missing something or is it a genuine bug? If so, I'll raise as an issue