Topic: error handling with external request
I'm using httparty to make an external request for a json file and then parsing it. How can I handle errors so I can still display the page should the request fail due to a bad uri or the file no longer exists? Just trying to protect my ass for the future. I haven't dealt with error handling, so I have no idea of how to tackle this issue.
Thank you for your help!
def json_api_pull(url)
JSON.parse HTTParty.get(url).response.body
endjson_api_pull('http://test.com/test.json')['test']