when a monitor's test command raises an error/exception stop monitor

and log the exception
- added error state to state machine