Better handle errors when using callbacks.