TypeError (class or module required for rescue proposal)
I've been using Stripe for over a year now, based on the Ryan Bates RailsCast episode I found here . However, my error handling recently stopped working and I have never seen this error before. I recently started running my application on Ruby 2.1 and as far as I can tell this is a problem.
This is the instance method in my model Subscription
:
begin
save_with_stripe_payment
rescue Stripe::InvalidRequestError => e
logger.error "Stripe error while creating customer: #{e.message}"
logger.error e.backtrace.join("\n")
errors.add :base, "There was a problem with your card."
false
rescue e
logger.error e.message
logger.error e.backtrace.join("\n")
errors.add :base, e.message
false
end
Line:
rescue Stripe::InvalidRequestError => e
is a bug. The structure from there goes to the "start" line, and that's it. What am I missing here?
+4
source to share