Added basic state check to workflow example

Wonder why need of state check is not even mentioned in readme
Shouldn't we throw an exception of some sort here, rather than exiting?