Handle the case where an account's domain has already been deleted (and thus the...
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Feb 2011 17:24:30 +0000 (12:24 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Feb 2011 17:24:30 +0000 (12:24 -0500)
bin/mailshears

index 9f913621667c686e49504e1b6f465458410c2ca8..5a156f9dce691be8f5e8d0b2e676bec840f2c7a2 100755 (executable)
@@ -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