Implemented terminateOnError.