Handle 502 errors with a BadGatewayError