Add rescue clause for 502 error