/// <summary>The register exception.</summary> /// <param name="retryPolicy">The retry policy.</param> /// <param name="state">The state.</param> /// <param name="context">The context.</param> /// <param name="e">The e.</param> /// <exception cref="RetryException"></exception> protected void RegisterThrowable(IRetryPolicy retryPolicy, IRetryState state, IRetryContext context, Exception e) { if (state != null) { var key = state.GetKey(); if (context.RetryCount > 0 && !this.retryContextCache.ContainsKey(key)) { throw new RetryException( "Inconsistent state for failed item key: cache key has changed. " + "Consider whether equals() or hashCode() for the key might be inconsistent, " + "or if you need to supply a better key"); } this.retryContextCache.Put(key, context); } retryPolicy.RegisterException(context, e); }