* add error handler for state machine