How do I rescue from a
undefined method
error in this code
for user in @users do
    @customer = Stripe::Customer.retrieve(user.stripe_customer_token)
        if @customer.subscription.nil?
        elsif @customer.subscription.plan.id == 2
          user.silver_reset
        elsif @customer.subscription.plan.id == 3
          user.gold_reset
      end
    end
I have tried a plain rescue call, but rake isn't liking it.
What is way to rescue from the error?
UPDATE:
The way I was doing it
 for    user in @users do
            @customer = Stripe::Customer.retrieve(user.stripe_customer_token)
         rescue_from Exception => exception
          # Logic
        end
        if @customer.subscription.nil?
        elsif @customer.subscription.plan.id == 2
          user.silver_reset
        elsif @customer.subscription.plan.id == 3
          user.gold_reset
      end
    end
The Error /home/user/rails_projects/assignitapp/lib/tasks/daily.rake:25: syntax error, unexpected keyword_rescue, expecting keyword_end rescue Exception => exception
Rake 0.9.2.2 Rails 3.2.5
 
     
     
    