This sentence extracted from a book. I wonder whether 'ensure' has been used correctly here? Or as I guess it should be either 'ensuring' or 'to ensure'?
What promises do is ensure that callbacks are always handled in the same predictable manner, eliminating some of the nasty surprises and hard-to-find bugs you can get with callbacks alone.