makes done accept a function and call it
catches exceptions on function passed to done