From: Michael Orlitzky Date: Thu, 3 Feb 2011 17:24:30 +0000 (-0500) Subject: Handle the case where an account's domain has already been deleted (and thus the... X-Git-Tag: 0.0.1~124 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=commitdiff_plain;h=18ac3d44b843b0f28fa748146eec78da0561f195 Handle the case where an account's domain has already been deleted (and thus the account is gone when we try to delete it). --- diff --git a/bin/mailshears b/bin/mailshears index 9f91362..5a156f9 100755 --- a/bin/mailshears +++ b/bin/mailshears @@ -116,8 +116,14 @@ Plugin.includers.each do |plugin_class| end leftover_accounts.each do |account| - plugin.delete_account(account) - puts "Removed: #{account} (#{plugin.describe_account(account)})" + begin + plugin.delete_account(account) + puts "Removed: #{account} (#{plugin.describe_account(account)})" + rescue NonexistentAccountError => e + # This usually happens after an account's domain is deleted. + # When we try to delete the account, it's already gone. + puts "Gone: #{account} (#{plugin.describe_account(account)})" + end end end