add pause function
add errorThen method and test