raise exception in case of errors in api response