I have some code to make API requests through Full contact to resolve domains for a list of company names, and output these in a csv table. I found the code was terminating whenever it hit a response code other than 200 or 202.
I have the following rescue block written:
def get_parse_all
ORG_ARRAY.each do |company_name|
begin
org_info = get_org_info(company_name)
rescue
next
end
parse_org_info(org_info)
end
end
The issue is, I can't figure out how to still include the skipped company names (due to bad response code)in the output. I am getting a list of the successful calls, but I can't tell which ones were skipped and why.
I have tried to puts "error"
before next, but it doesn't appear in the output csv. And if I remove next, I get a nil:NilClass (NoMethodError)
I've read some documentation but I am new to this and I'm quite stuck. If someone could point me in the right direction, that would be greatly appreciated!
Thank you in advance for any help :)