catches exceptions on function passed to done