function getAndExpectError(mainRecord, context) {
    const error = getNetworkError(mainRecord, {warnings: [], ...context});
    if (!error) throw new Error('expected a network error');
    return error;
  }
@param {NetworkRequest=} mainRecord
@param {{warnings: Array<string | LH.IcuMessage>, ignoreStatusCode?: LH.Config.Settings['ignoreStatusCode']}=} context