+ begin
+ tried << service
+ raise InvalidService, "#{service} blacklisted" if @blacklist.include?(service)
+ short = ShortURL.shorten(url, service)
+ raise InvalidService, "#{service} returned an empty string for #{url}" unless short and not short.empty?
+ rescue InvalidService
+ pool = services - tried
+ if pool.empty?
+ m.reply "#{service} failed, and I don't know what else to try next" unless params[:called]
+ return nil
+ else
+ service = pool.pick_one
+ m.reply "#{tried.last} failed, I'll try #{service} instead" unless params[:called]
+ retry
+ end