It's probably sufficient to just wrap the callback in a try/catch block, but I don't think there's really anything wrong with doing it this way either.