check for error before looking at response