using closures to test error state