I'm interacting with CampaignMonitor's API using the ruby wrapper (createsend-ruby) and I'm just wondering what you'd recommend as far as error/exception handling. I was thinking of just using begin/rescue/end as follows, but I just want to know if there are any better techniques for this sort of thing (when you're dealing with a 3rd-party API).
begin
list_id = CreateSend::List.create client_id, title, unsubscribe_page, confirmed_opt_in, confirmation_success_page
rescue Exception => e
logger.error "[error] CampaignMonitor error: #{e}"
return false
end
For instance, would you try to catch specific exceptions and deal with them individually?
rescue CreateSend::BadRequest => e
Or is this just a matter of individual preference and/or app requirements?
Thank you for your time!