Handle failures in the block passed to Promise#flat_map