private static void ThrowOperationCanceledExceptionIfNeeded()

in JetBrains.Profiler.SelfApi/src/Impl/PrerequisiteBase.cs [205:214]


    private static void ThrowOperationCanceledExceptionIfNeeded(Exception e, int maxExceptionDepth = 5)
    {
      for (var i = 0; i < maxExceptionDepth && e != null; i++)
      {
        if(e is WebException webException)
          if (webException.Status == WebExceptionStatus.RequestCanceled)
            throw new OperationCanceledException("Failed to download prerequisite package. Operation was cancelled.", e);
        e = e.InnerException;
      }
    }