handle bad gateway and parser errors