use error block to capture