Better to use state machine in such requirements
If you will get error in any one of state then you can change its state to the initial state.
Regards…!! Aksh