Skip to content

Releases: kolan72/PoliNorError

2.20.0

25 Dec 14:45
Compare
Choose a tag to compare

Improvements

  • Introduce the DefaultErrorProcessor<TParam> , ProcessingErrorContext<TParam> and ProcessingErrorInfo<TParam> classes.
  • Introduce the SimplePolicy.Handle<TErrorContext>(Action, TErrorContext, CancellationToken) method.
  • Introduce the SimplePolicy.Handle<TParam>(Action<TParam>, TParam, CancellationToken) method.
  • Introduce the Handle<TParam, T>(Func<TParam, T>, TParam, CancellationToken) and Handle<TErrorContext, T>(Func<T> func, TErrorContext param, CancellationToken) methods of SimplePolicy.
  • Introduce overloads for the SimplePolicy.HandleAsync<TParam> and SimplePolicy.HandleAsync<TErrorContext> methods.
  • Introduce overloads for the SimplePolicy.HandleAsync<TParam, T> and SimplePolicy.HandleAsync<TErrorContext, T> methods.
  • Introduce the SimplePolicy.WithErrorContextProcessor<TErrorContext> and SimplePolicy.WithErrorContextProcessorOf<TErrorContext> method overloads.
  • Introduce the SimplePolicyProcessor.Execute<TParam>(Action) method.
  • Introduce the SimplePolicyProcessor.Execute<TParam>(Action<TParam>, TParam, token) method.
  • Introduce the SimplePolicyProcessor.Execute<TErrorContext, T>(Func<T>, TErrorContext, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.Execute<TParam, T>(Func<TParam, T>, TParam, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.ExecuteAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, bool, CancellationToken) method.
  • Introduce the SimplePolicyProcessor.WithErrorContextProcessor<TErrorContext> and SimplePolicyProcessor.WithErrorContextProcessorOf<TErrorContext> method overloads.
  • Introduce the Func<CancellationToken, Task<T>>.InvokeWithTryCatchAsync extension method.
  • Introduce InvokeWithTryCatchAsync extension methods overloads for the Func<CancellationToken, Task<T>>, Func<CancellationToken, Task> delegates.
  • Introduce the Func<CancellationToken, Task>.InvokeWithTryCatchAsync extension method.
  • Introduce the Func<T>.InvokeWithTryCatch extension method.
  • Introduce the Action.InvokeWithTryCatch extension method.
  • Introduce TryCatchBuilder.AddCatchBlock method overloads with NonEmptyCatchBlockFilter, IBulkErrorProcessor parameters.
  • Introduce the TryCatchBuilder.AddCatchBlock method overload with the NonEmptyCatchBlockFilter parameter.
  • Introduce the TryCatchBuilder.AddCatchBlock method overload with the IBulkErrorProcessor parameter.
  • Introduce TryCatchBuilder.CreateFrom method overload with NonEmptyCatchBlockFilter, IBulkErrorProcessor parameters.
  • Introduce the TryCatchBuilder.CreateFrom method overload with the NonEmptyCatchBlockFilter parameter.
  • Introduce the TryCatchBuilder.CreateFrom method overload with the IBulkErrorProcessor parameter.
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method without parameters.
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method with the IBulkErrorProcessor parameter
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method with the Func<Exception, Task> parameter.
  • Introduce shorthand TryCatchBuilder.CreateAndBuild method with the Action<Exception> parameter.

Small changes

  • Deprecate the BulkErrorProcessor(PolicyAlias) constructor.
  • Made PolicyProcessor constructors that use the PolicyAlias parameter and the _isPolicyAliasSet field obsolete.
  • Call the ConfigureAwait method in the ErrorProcessorBase.ProcessAsync method with the configAwait parameter passed.
  • Add the internal class EmptyErrorContext<TParam>.
  • Add the Policy.HasPolicyWrapperFactory internal property.
  • Add the Rider-related .gitignore.

Docs changes

  • Edit 'Policy wrap' README Chapter.
  • Update 'RetryPolicy' README Chapter and example in README for NuGet package.

Bumps and Dependency updates

  • Bump the nunit group with 7 updates.
  • Remove old references to NUnit-related nuget packages in the PoliNorError.Tests project file.

2.19.15

17 Nov 15:54
Compare
Choose a tag to compare

Improvements

  • Introduce RetryPolicy.WithWait(DelayErrorProcessor) method.
  • DefaultRetryProcessor refactoring - add field representing retry policy rule.
  • Add the RetryContext.IsZeroRetry property and use it to set the PolicyResult.NoError property to true.
  • Slightly improved performance for the RetryPolicy custom error saver by passing the ErrorContext<RetryContext> instead of int tryCount arg in the DefaultRetryProcessor.SaveError(Async) methods.
  • Deprecate ProcessingErrorContext.CurrentRetryCount property.
  • Introduce the Policy.WrapPolicyCollection extension method.
  • Argument exception guard clause for the PolicyCollection.WrapUp method with the ThrowOnWrappedCollectionFailed.None value for the throwOnWrappedCollectionFailed parameter.
  • Argument exception guard clause for the Policy.WrapPolicyCollection method with the ThrowOnWrappedCollectionFailed.None value for the throwOnWrappedCollectionFailed parameter.
  • Made the Policy class constructor protected (previously private protected).
  • Introduce PolicyResultHandlerFailedException.Result property.
  • Introduce PolicyResultHandlerFailedException<T> exception.

Small changes

  • Made the cancellationToken parameter optional in PolicyDelegate(<T>).HandleAsync methods.
  • Directly return Task instead of await when converting async uncancelable generic fallback delegate to cancelable with CancellationType.Precancelable argument.
  • New tests for the PolicyCollection.WrapUp method with the ThrowOnWrappedCollectionFailed.CollectionError parameter.
  • New tests for a wrapped SimplePolicy that wraps another policy.
  • Move the tests for the RetryDelay classes to a separate folder.

Docs changes

  • Add doc comments to the public members of the PolicyBuilding class.
  • Put the nuget README in the file.
  • Update 'RetryPolicy' README Chapter.
  • Correct retry terminology in README.
  • Correct 'Error processors' README Chapters.

Bumps and Dependency updates

  • Bump NSubstitute from 5.1.0 to 5.3.0.
  • Bump System.Numerics.Vectors from 4.5.0 to 4.6.0.
  • Bump System.Buffers from 4.5.1 to 4.6.0.
  • Bump System.Runtime.CompilerServices.Unsafe from 6.0.0 to 6.1.0.

2.19.11

16 Oct 10:35
Compare
Choose a tag to compare

Improvements

  • Introduce SlopeFactor for LinearRetryDelay.
  • Slightly improved performance for RetryPolicy by removing the overhead of using the int tryCount argument in the DefaultRetryProcessor.DelayIfNeedAsync(Async) methods.
  • Introduce PolicyCollection.WithRetry, PolicyCollection.WithInfiniteRetry methods with RetryDelay parameter.
  • Introduce PolicyDelegateCollection.WithRetry, PolicyDelegateCollection.WithInfiniteRetry methods with RetryDelay parameter.
  • Introduce PolicyDelegateCollection<T>.WithRetry, PolicyDelegateCollection<T>.WithInfiniteRetry methods with RetryDelay parameter.
  • Introduce RetryPolicy.SetPolicyResultFailedIf method overloads with Action<PolicyResult<T>> handler parameter for RetryPolicy, SimplePolicy and Fallback policies.

Small changes

  • Move null guards before getting a fallback delegate in FallbackPolicyBase.
  • Remove deprecated suppression for PolicyResultHandlingException.

Docs changes

  • Add doc comments to the public members of the PolicyDelegate and PolicyDelegate<T> classes.
  • Add doc comments to the public members of the PolicyDelegateResult and PolicyDelegateResult<T> classes.
  • Add doc comments to the public members of the PolicyResult and PolicyResult<T> classes, and to the PolicyResultFailedReason enum.
  • Update 'Calling Func and Action delegates in a resilient manner' README Chapter.
  • Update 'RetryPolicy' README Chapter.

2.19.8

22 Sep 13:42
Compare
Choose a tag to compare

Improvements

  • Introduce Policy error filtering extension methods in the PoliNorError.Extensions.PolicyErrorFiltering namespace.
  • Fix issue #126 by using the IDelayProvider.BackoffBackoffSafely(Async) extension methods.
  • Introduce Action.InvokeWithRetryDelay extension methods.
  • Introduce Action.InvokeWithRetryDelayInfinite  extension methods.
  • Introduce Func<CancellationToken, Task>.InvokeWithRetryDelayAsync extension methods.
  • Introduce Func<CancellationToken, Task>.InvokeWithRetryDelayInfiniteAsync extension methods.
  • Introduce Func<T>.InvokeWithRetryDelay extension methods.
  • Introduce Func<T>.InvokeWithRetryDelayInfinite extension methods.
  • Introduce Func<CancellationToken, Task<T>>.InvokeWithRetryDelayAsync extension methods.
  • Introduce Func<CancellationToken, Task<T>>.InvokeWithRetryDelayInfiniteAsync extension methods.

Small changes

  • Add early return in RetryProcessor.Retry(Async)(<T>) methods if token is already canceled.
  • DRY Refactoring of the use of RetryDelay in DefaultRetryProcessor methods.
  • Refactor catch block exception handling in DefaultRetryProcessor.Retry(Async)<T> methods.
  • Add 'Try', 'Catch' tags to nuget package.

Docs changes

  • Update 'RetryPolicy' README Chapter.
  • Add doc comments to CatchBlockExceptionSource.
  • Bump NUnit from 4.1.0 to 4.2.1.
  • Bump NUnit from 4.2.1 to 4.2.2.

2.19.5

20 Aug 15:27
Compare
Choose a tag to compare

Improvements

  • Introduce jittering for RetryDelay subclasses, adapted from Polly.
  • Introduce RetryDelayOptions.MaxDelay property.
  • Introduce Create static methods for ConstantRetryDelay, LinearRetryDelay, ExponentialRetryDelay classes.

Small changes

  • Bump NUnit3TestAdapter from 4.5.0 to 4.6.0 in the nunit group.

2.19.0

24 Jul 13:13
Compare
Choose a tag to compare

Improvements

  • Add the RetryDelay class and its subclasses(ConstantRetryDelay, LinearRetryDelay, ExponentialRetryDelay).
  • Change RetryPolicy ctor signature to accept the RetryDelay parameter.
  • Add the RetryDelay parameter to the RetryPolicy.InfiniteRetries method overloads.
  • Modify RetryPolicy.Handle(Async)<T> methods to use the RetryDelay.
  • Add DefaultRetryProcessor.Retry method overloads and RetryInfinite method to handle Action with RetryDelay parameter.
  • Add DefaultRetryProcessor.Retry<T> method overloads and RetryInfinite<T> method to handle Func<T> with RetryDelay parameter.
  • Add DefaultRetryProcessor.RetryAsync method overloads and RetryInfiniteAsync method to handle Func<CancellationToken, Task> with RetryDelay parameter.
  • Add DefaultRetryProcessor.RetryAsync<T> method overloads and RetryInfiniteAsync<T> method to handle Func<CancellationToken, Task<T>> with RetryDelay parameter.
  • Add internal DelayProvider class.
  • Refactoring to use the DelayProvider class in the DelayErrorProcessor class.
  • Introduce RetryProcessingErrorInfo class, add ProcessingErrorInfo.CurrentContext property, deprecate ProcessingErrorInfo.CurrentRetryCount property.

Small changes

  • DRY refactoring and new tests for RetryPolicy.WithWait method overloads.

Docs changes

  • Add doc comments to IRetryProcessor class.
  • Add doc comments to RetryCountInfoOptions class and RetryCountInfo struct.
  • Update 'RetryPolicy' README Chapter.
  • Update 'TryCatch' README Chapter.

2.18.14

01 Jul 16:38
Compare
Choose a tag to compare

Improvements

  • Introduce the NonEmptyCatchBlockFilter.ExcludeErrorSet, NonEmptyCatchBlockFilter.IncludeErrorSet methods.
  • Introduce the CatchBlockHandlerFactory.FilterExceptionsByIncluding(IErrorSet), CatchBlockHandlerFactory.FilterExceptionsByExcluding(IErrorSet) methods.

Small changes

  • DRY refactoring of the method that gets the IsError property of the TryCatchResult and TryCatchResult<T> classes.
  • Remove redundant IErrorsAggregator<T>, IErrorsToStringAggregator interfaces, DefaultErrorsToStringAggregator class, internal ProcessingErrorContext constructor.
  • Remove unnecessary value assignment (IDE0059) in tests.

Docs changes

  • Add doc comments to IErrorSet interface and ErrorSet class.

2.18.11

08 Jun 21:40
Compare
Choose a tag to compare

Improvements

  • For CatchBlockFilter, NonEmptyCatchBlockFilter classes. add ExcludeError, IncludeError fluent methods overloads for inner exception types.
  • For NonEmptyCatchBlockFilter class, add CreateByIncluding, CreateByExcluding fluent methods overloads with possibility to add inner exception types.
  • Introduce NonEmptyCatchBlockFilter.CreateByIncluding(IErrorSet), NonEmptyCatchBlockFilter.CreateByExcluding(IErrorSet) static methods.
  • For FallbackFuncsProvider class, add protected SetFallbackAction, SetAsyncFallbackFunc methods with CancellationType param.
  • Directly return Task instead of await when converting async uncancelable non-generic delegate to precancelable when registering PolicyResult handler with CancellationType.Precancelable argument.
  • Directly return Task instead of await when converting async uncancelable non generic fallback delegate to cancelable with CancellationType.Precancelable argument.

Small changes

  • Throw a NotImplementedException exception in the PolicyResult.SetErrors protected method.
  • DRY refactoring for IncludeError, ExcludeError methods of CatchBlockFilter, NonEmptyCatchBlockFilter classes.

Docs changes

  • Update 'FallbackPolicy' README Chapter.
  • Update 'Error filters' README Chapter.
  • Update 'TryCatch' README Chapter.

2.18.4

22 May 12:18
Compare
Choose a tag to compare

Improvements

  • Introduce the FromInnerError, WithInnerError methods of the ErrorSet class.
  • Introduce TryCatchResult(<T>).IsSuccess property.
  • Directly return Task instead of await in asynchronous error processing scenarios with the CancellationType.Precancelable argument.
  • Use Task.GetAwaiter().GetResult() instead of the Task.Wait method in sync-over-async error processing scenarios with the CancellationType.Precancelable argument.

Small changes

  • Remove the obsolete ProcessingErrorContext.FromRetry method.
  • Correct error set related test names for DefaultFallbackProcessorTests, DefaultRetryProcessorTests and SimplePolicyProcessorTests.
  • Remove redundant ErrorWithInnerExcThrowingFuncs.FunWithInner method in tests.

Docs changes

  • Add README main content.
  • Update 'PolicyResult' README Chapter.

2.18.0

30 Apr 19:36
Compare
Choose a tag to compare

Improvements

  • Introduce IncludeErrorSet(IErrorSet), ExcludeErrorSet(IErrorSet) methods for PolicyCollection.
  • Introduce IncludeErrorSet(IErrorSet) and ExcludeErrorSet(IErrorSet) extension methods for the PolicyDelegateCollection(<T>) classes.
  • Introduce the TryCatchBase class and the ITryCatch<T> interface for dependency injection scenarios.

Small changes

  • Introduce ITryCatch.HasCatchBlockForAll property.
  • Dispose of CancellationTokenSource objects in tests where it was absent.

Docs changes

  • Add code coverage badge.
  • Update 'Error filters' README Chapter.
  • Update 'TryCatch' README Chapter.