Releases: kolan72/PoliNorError
Releases · kolan72/PoliNorError
2.24.20
Improvements
- Eliminated closure allocations across all
Fallback,Retry, andExecutepolicy processor methods by introducing internal/private overloads that accept the originalAction<TParam>,Func<TParam, T>,Func<TParam, CancellationToken, Task>andFunc<TParam, CancellationToken, Task<T>>delegates directly.
Applied these optimizations consistently to:DefaultRetryProcessor(sync and async variants, with and withoutRetryDelay/RetryCountInfo)DefaultFallbackProcessor(sync and async variants)SimplePolicyProcessor(sync and async execution paths)
- Add
DefaultRetryProcessorasync method overloads with requiredCancellationTokenparameter (noconfigureAwait), delegating to existing methods withconfigureAwaitset tofalse:RetryAsync<TParam>andRetryAsync<TParam, T>(with and withoutRetryDelay)RetryInfiniteAsync<TParam>andRetryInfiniteAsync<TParam, T>(with and withoutRetryDelay)RetryWithErrorContextAsync<TErrorContext>andRetryWithErrorContextAsync<TErrorContext, T>(with and withoutRetryDelay)RetryInfiniteWithErrorContextAsync<TErrorContext>andRetryInfiniteWithErrorContextAsync<TErrorContext, T>(with and withoutRetryDelay)
- Add
DefaultFallbackProcessorasync method overloads with requiredCancellationTokenparameter (noconfigureAwait), delegating to existing methods withconfigureAwaitset tofalse:FallbackAsync<TErrorContext>andFallbackAsync<TErrorContext, T>FallbackAsync<TParam>andFallbackAsync<TParam, T>
- Add
SimplePolicyProcessorasync method overloads with requiredCancellationTokenparameter (noconfigureAwait), delegating to existing methods withconfigureAwaitset tofalse:ExecuteAsync<TErrorContext>andExecuteAsync<TErrorContext, T>ExecuteAsync<TParam>andExecuteAsync<TParam, T>
- Introduce abstract
ErrorProcessor<TParam>with an overridableExecutemethod for parameter-aware error processing. - Introduce
void Policy.AddHandlerForPolicyResultextension method overloads. - Introduce an internal
PolicyResult.SetCanceledEarlymethod to markNoErrorastrueon early cancellation and apply it to all coreRetry,Fallback, andSimplepolicy processor methods.
Small changes
- Convert
SimplePolicyProcessor.AddErrorAndCatchBlockFilterErrorfrom a private method to an extension method on thePolicyResultclass. - Add internal
PolicyResult.ToLastPolicyResultStateextension method and refactor to useLastPolicyResultStateclass. - Refactor
PolicyProcessor.ExceptionFilterby extracting its logic into a new internalExceptionFilterSetclass. - DRY refactor
ConstantRetryDelay. - DRY refactor
ExponentialRetryDelay. - DRY refactor
LinearRetryDelay. - DRY refactor
TimeSeriesRetryDelay. - DRY refactoring of all internal
IPolicyProcessor.WithErrorContextProcessorOf<T, TErrorContext>extension methods to unify shared logic across their variousAction<Exception, ProcessingErrorInfo<TErrorContext>>overloads. - DRY refactoring of all internal
IPolicyProcessor.WithErrorContextProcessorOf<T, TErrorContext>extension methods to unify shared logic across their variousFunc<Exception, ProcessingErrorInfo<TErrorContext>, Task>overloads. - Refactor
PolicyDelegateCollectionResultBaseinternal constructor and add new tests forPolicyDelegateCollectionResult. - Mark
PolicyResult.ChangeByRetryDelayResultas obsolete. - Rename
DefaultRetryProcessor.RetryOverloads.csfile toDefaultRetryProcessor.RetryOverloads.RetryDelay.cs. - Move all
DefaultRetryProcessor.Retry...methods that take anint retryCountparameter intoDefaultRetryProcessor.RetryOverloads.LimitedRetries.cs. - Move all
DefaultRetryProcessor.Retry…methods withRetryDelayandint retryCountparameters intoDefaultRetryProcessor.RetryOverloads.RetryDelay.LimitedRetries.cs. - Move all
DefaultRetryProcessormethods that useConfigureAwait(false)into the new filesDefaultRetryProcessor.RetryAsync.ConfigureAwaitFalse.csandDefaultRetryProcessor.RetryDelay.RetryAsync.ConfigureAwaitFalse.cs - Move non-interface
DefaultRetryProcessor Retry(Async)methods toDefaultRetryProcessor.RetryOverloads.cs. - Add new tests for
RetryCountInfo.
Docs changes
- Update XML documentation for
ErrorProcessor.ProcessandErrorProcessor.ProcessAsyncto clarify that both methods directly callExecute. - Add
PolicyResult.WrappedStatuschecks to existing tests. - Edit 'Error processors' README Chapter.
- Edit 'Retry-Then-Fallback' README chapter.
- Update
PolicyResultREADME Chapter. - Add THIRD-PARTY-NOTICES.
2.24.12
Improvements
- Introduced the
PolicyResult.WrappedStatusproperty and the enum-likeWrappedPolicyStatusclass, which encapsulate wrapped policy status values. - Introduced the
SimplePolicy.ThenFallbackmethod. - Introduced
Policy.AddHandlerForPolicyResultextension methods in the newPoliNorError.Extensions.PolicyResultHandlingnamespace. - Introduce abstract
ErrorProcessorclass withExecutemethod that implementors must override to define error processing logic. - Support cancellation via linked token in
FallbackPolicy.HandleAsyncandDefaultFallbackProcessor.FallbackAsyncoverloads. - Support cancellation via linked token in
FallbackPolicy.HandleandDefaultFallbackProcessor.Fallbackoverloads. - Support cancellation via linked token in
FallbackPolicy.Handle<T>andDefaultFallbackProcessor.Fallback<T>overloads. - Support cancellation via linked token in
FallbackPolicy.HandleAsync<T>andDefaultFallbackProcessor.FallbackAsync<T>overloads. - Support cancellation via linked token in
SimplePolicy.HandleAsyncandSimplePolicyProcessor.ExecuteAsyncoverloads. - Support cancellation via linked token in
SimplePolicy.HandleandSimplePolicyProcessor.Executeoverloads. - Support cancellation via linked token in
SimplePolicy.Handle<T>andSimplePolicyProcessor.Execute<T>overloads. - Support cancellation via linked token in
SimplePolicy.HandleAsync<T>andSimplePolicyProcessor.ExecuteAsync<T>overloads. - Support cancellation via linked token in
RetryPolicy.HandleAsyncandDefaultRetryProcessor.RetryAsyncoverloads. - Support cancellation via linked token in
RetryPolicy.HandleandDefaultRetryProcessor.Retryoverloads. - Support cancellation via linked token in
RetryPolicy.Handle<T>andDefaultRetryProcessor.Retry<T>overloads. - Support cancellation via linked token in
RetryPolicy.HandleAsync<T>andDefaultRetryProcessor.RetryAsync<T>overloads. - Support cancellation via linked token in the
BulkErrorProcessor.ProcessAsyncmethod. - Support cancellation via linked token in the
BulkErrorProcessor.Processmethod. - Add early return in
BulkErrorProcessor.Processforeach loop when cancellation occurs while processing the current error processor. - Supported cancellation via a linked token in the internal
IDelayProvider.BackoffSafelyAsyncextension method. - Supported cancellation via a linked token in the internal
IDelayProvider.BackoffSafelyextension method. - Introduced internal
IDelayProvider.DelayAndCheckIfResultFailedextension method to replace theIDelayProvider.BackoffSafelymethod. - Introduced internal
IDelayProvider.DelayAndCheckIfResultFailedAsycextension method to replace theIDelayProvider.BackoffSafelyAsyncmethod. - DRY refactoring of exception handling in
SimplePolicyProcessor.ExecuteAsyncandSimplePolicyProcessor.ExecuteAsync<T>via internalSimpleAsyncExceptionHandlerclass. - DRY refactoring of exception handling in
SimplePolicyProcessor.ExecuteandSimplePolicyProcessor.Execute<T>via internalSimpleSyncExceptionHandlerclass. - DRY refactoring of exception handling in
DefaultFallbackProcessor.FallbackandDefaultFallbackProcessor.Fallback<T>via internalSimpleSyncExceptionHandlerclass. - DRY refactoring of exception handling in
DefaultFallbackProcessor.FallbackAsyncandDefaultFallbackProcessor.FallbackAsync<T>via internalSimpleAsyncExceptionHandlerclass. - Refactor exception handling in
DefaultFallbackProcessor.Fallbackcatch block to mark the result as canceled only when the passed or linked token is canceled. - Refactor exception handling in
DefaultFallbackProcessor.FallbackAsynccatch block to mark the result as canceled only when the passed or linked token is canceled. - Refactor exception handling in
DefaultFallbackProcessor.Fallback<T>catch block to mark the result as canceled only when the passed or linked token is canceled. - Refactor exception handling in
DefaultFallbackProcessor.FallbackAsync<T>catch block to mark the result as canceled only when the passed or linked token is canceled. - Ensure
DefaultFallbackProcessor.FallbackAsync<T>returnsFallbackFuncExecResult<T>with result on success path (test correction). - Introduced internal
IDelayProvider.DelayAndCheckIfResultFailedextension method to replace theIDelayProvider.BackoffSafelymethod. - Introduced internal
IDelayProvider.DelayAndCheckIfResultFailedAsycextension method to replace theIDelayProvider.BackoffSafelyAsyncmethod. - Reduce allocations and GC load on each retry by using the
IDelayProvider.DelayAndCheckIfResultFailedmethod (stop usingBasicResultclass in retry processing). - Allows combining
DelayErrorProcessorwith error processors that support context.
Small changes
- Support safe enumeration of the library-internal collection
FlexSyncEnumerable<T>when accessed asynchronously. - Remove the extra check from the internal
PolicyResult.ChangeByHandleCatchBlockResultextension method and rename it toWasResultSetToFailureByCatchBlock. - Mark
IDelayProvider.BackoffSafelyandIDelayProvider.BackoffSafelyAsyncas obsolete. - Add
CatchBlockExceptiontoPolicyResult<T>.CatchBlockErrorswhen cancellation occurs in generic fallback function. - Add
CatchBlockExceptiontoPolicyResult.CatchBlockErrorswhen cancellation occurs in fallback function. - Add test to verify
PolicyResult<T>.CatchBlockErrorscontains exception when generic fallback function throws. - Add test to verify
PolicyResult.CatchBlockErrorscontains exception when fallback function throws. - Moved linked token cancellation tests into a single CancellationTests file.
Docs changes
- Add XML summary comments for
BulkErrorProcessor. - Add 'Retry-Then-Fallback' README Chapter.
Bumps and Dependency updates
- Update NUnit NuGet package to v4.4.0.
2.24.0
Improvements
- Introduced the
RetryPolicy.ThenFallbackmethod that implements the retry-then-fallback pattern. - Introduced the PolicyResult.PolicyCanceledError property, which stores the
OperationCanceledExceptionwhen cancellation occurs. - Fix issue #150.
- Introduced
TimeSeriesRetryDelayclass - Introduced the
TimeSeriesRetryDelayOptionsclass and addedTimeSeriesto theRetryDelayTypeenum. - Made
DefaultFallbackProcessorimplement theICanAddErrorFilter<DefaultFallbackProcessor>interface. - Made
FallbackPolicyBaseimplement theICanAddErrorFilter<FallbackPolicyBase>interface. - Made
FallbackPolicyimplement theICanAddErrorFilter<FallbackPolicy>interface. - Made
FallbackPolicyWithAsyncFuncimplement theICanAddErrorFilter<FallbackPolicyWithAsyncFunc>interface. - Made
FallbackPolicyWithActionimplement theICanAddErrorFilter<FallbackPolicyWithAction>interface. - Made
SimplePolicyProcessorimplement theICanAddErrorFilter<SimplePolicyProcessor>interface. - Made
SimplePolicyimplement theICanAddErrorFilter<SimplePolicy>interface. - Introduced the
FallbackFuncsProvider.ToFallbackPolicymethod. - Prevent
NullReferenceExceptionwhen aFallbackPolicyBase- derived class is initialized byFallbackFuncsProvider. - Introduced the
BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken, Task>)method. - Introduced the
BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken>)method. - Introduced the
BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>>)extension method and its overloads. - Introduced the
BulkErrorProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, Task>)extension method and its overloads. - Introduced the
BulkErrorProcessor.WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext)method. - Introduced the
GetAttemptCount()extensions method forProcessingErrorInfo. - Introduced a
DelayErrorProcessorconstructor that accepts aRetryDelayparameter. - Add an internal extension method
GetCancellationException()forAggregateException. - Refactor
AddIncludedErrorFilterForAll<TException>extension methods forIEnumerable<IPolicyBase>. - Refactor
AddExcludedErrorFilterForAll<TException>extension methods forIEnumerable<IPolicyBase>. - Handle null comparison safely in
ErrorSetItem - Introduced the
IBulkErrorProcessor.WithDelayBetweenRetries(TimeSpan)extension method. - Prevent
NullReferenceExceptionwhenProcessingErrorContextparameter isnullinBulkErrorProcessor.Process(Async)methods. - Refactor internal extension method
ExceptionFilter.AddIncludedErrorSet. - Refactor internal extension method
ExceptionFilter.AddExcludedErrorSet. - Refactor how the error context processor is added to the policy processor in the
ErrorProcessorRegistrationclass. - Added internal
IPolicyResultHandlerCollectioninterface. - Deprecate the
BulkProcessStatusenum.
Docs changes
- Edit 'RetryPolicy' README chapter.
- Edit 'Key Concepts' README Chapter.
- Add 'Tips and Tricks' README Chapter.
2.23.0
Improvements
- Introduced the
RetryPolicy.Handle<TErrorContext>(Action, TErrorContext, CancellationToken)method. - Introduced the
RetryPolicy.Handle<TParam>(Action<TParam>, TParam, CancellationToken)method. - Introduced the
RetryPolicy.Handle<TErrorContext, T>(Func<T>, TErrorContext, CancellationToken)method. - Introduced the
RetryPolicy.Handle<TParam, T>(Func<TParam, T>, TParam, CancellationToken)method. - Introduced the
RetryPolicy.HandleAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, ... ,CancellationToken)method overloads. - Introduced the
RetryPolicy.HandleAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, ... ,CancellationToken)method overloads. - Introduced the
RetryPolicy.HandleAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, ...,CancellationToken)method overloads. - Introduced the
RetryPolicy.HandleAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, ... ,CancellationToken)method overloads. - Introduced the
IRetryExecutionInfointerface, which is implemented byRetryProcessingErrorInfoandRetryProcessingErrorInfo<TParam>. - Introduced the
GetRetryCount()extensions method forProcessingErrorInfo. - Introduced the
RetryPolicy.WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext>)method. - Introduced the
RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>>)method and its overloads. - Introduced the
RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken>)method. - Introduced the
RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, Task>)and its overloads. - Introduced the
RetryPolicy.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken, Task>)method. - Added an optional bool excludeLastPolicy parameter (default:
false) to thePolicyCollection.AddPolicyResultHandlerForAll(Func<PolicyResult, CancellationToken, Task>, ...)method. - Added an optional bool excludeLastPolicy parameter (default:
false) to thePolicyCollection.AddPolicyResultHandlerForAll(Func<PolicyResult, Task>, CancellationType, ...)overloads. - Added an optional bool excludeLastPolicy parameter (default:
false) to thePolicyCollection.AddPolicyResultHandlerForAll<T>(Func<PolicyResult<T>, Task>, CancellationType, ...)overloads. - Added an optional bool excludeLastPolicy parameter (default:
false) to thePolicyCollection.AddPolicyResultHandlerForAll<T>(Action<PolicyResult<T>>, CancellationType, ...)overloads. - Added an optional bool excludeLastPolicy parameter (default:
false) to thePolicyCollection.AddPolicyResultHandlerForAll<T>(Func<PolicyResult<T>, CancellationToken, Task>, ...)method. - Added an optional bool excludeLastPolicy parameter (default:
false) to thePolicyCollection.AddPolicyResultHandlerForAll<T>(Action<PolicyResult<T>, CancellationToken>, ...)method. - Added an optional bool excludeLastPolicy parameter (default:
false) to thePolicyCollection.AddPolicyResultHandlerForAll(Action<PolicyResult, CancellationToken>, ...)method. - Add an internal
DelayErrorProcessorconstructor overload that accepts anIDelayProvider. - Introduced the
RetryDelay(Func<int, TimeSpan> delayValueProvider)constructor. - Introduced the
RetryDelay(RetryDelayOptions)constructor. - Added the protected
RetryDelay.DelayValueProviderproperty and deprecated theInnerDelayandInnerDelayValueProviderproperties. - Added the
ICanAddErrorFilter<T>interface and implemented it inRetryPolicyandDefaultRetryProcessor. - Introduced the
IBulkErrorProcessor.WithDelayBetweenRetries(Func<int,Exception, TimeSpan>)extension method. - Introduced the
TryCatchBuilder.AddCatchBlock(Func<IEmptyCatchBlockFilter, NonEmptyCatchBlockFilter>, IBulkErrorProcessor)method and deprecated theTryCatchBuilder.AddCatchBlock(Func<IEmptyCatchBlockFilter, NonEmptyCatchBlockFilter>, Action<IBulkErrorProcessor>)method. - Added the
ExceptionFilter.AppendFilter(ExceptionFilter)method. - DRY refactoring to add a policy result handler to
PolicyCollection. - Refactor
Policy.HandlePolicyResult(Async)methods.
Docs changes
- Update 'RetryPolicy' README Chapter.
- Update NuGet package README.
Bumps and Dependency updates
- Update
System.Memoryto version 4.0.5.0 in 'PoliNorError.Tests'. - Bump
System.Runtime.CompilerServices.UnsafeandSystem.Threading.Tasks.Extensionsin 'PoliNorError.Tests'.
2.22.0
Improvements
- Introduced overloads of these methods, with and without the
RetryDelayparameter:DefaultRetryProcessor.RetryWithErrorContextAsync<TErrorContext>(Action, TErrorContext, ..., ..., CancellationToken)DefaultRetryProcessor.Retry<TParam>(Action<TParam>, TParam, RetryCountInfo, RetryDelay, CancellationToken)DefaultRetryProcessor.RetryInfiniteWithErrorContext<TErrorContext>(Action, TErrorContext, CancellationToken)DefaultRetryProcessor.RetryInfinite<TParam>(Action<TParam>, TParam, ..., CancellationToken)DefaultRetryProcessor.RetryWithErrorContextAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext param, ..., ..., configureAwait, token)DefaultRetryProcessor.RetryAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, ..., ..., bool, CancellationToken)DefaultRetryProcessor.RetryInfiniteWithErrorContextAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, ..., bool, CancellationToken)DefaultRetryProcessor.RetryInfiniteAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, bool, CancellationToken)DefaultRetryProcessor.RetryWithErrorContext<TErrorContext, T>(Func<T> func, TErrorContext param, …, CancellationToken)DefaultRetryProcessor.Retry<TParam, T>(Func<TParam, T>, TParam, ..., CancellationToken)DefaultRetryProcessor.RetryInfiniteWithErrorContext<TErrorContext, T>(Func<T>, TErrorContext, CancellationToken)DefaultRetryProcessor.RetryInfinite<TParam, T>(Func<TParam, T>, TParam, CancellationToken)DefaultRetryProcessor.RetryWithErrorContextAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, ..., bool, CancellationToken)DefaultRetryProcessor.RetryAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>, TParam, ..., bool, CancellationToken)DefaultRetryProcessor.RetryInfiniteWithErrorContextAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, ..., bool, CancellationToken)DefaultRetryProcessor.RetryInfiniteAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, ..., bool, CancellationToken)
- Introduced the
DefaultRetryProcessor.WithErrorContextProcessorOf<TErrorContext>(Action<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken>)method. - Introduced the
DefaultRetryProcessor.WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext>)method. - Introduced the
DefaultRetryProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, CancellationToken, Task>)method. - Introduced the
DefaultRetryProcessor.WithErrorContextProcessorOf<TErrorContext>(Func<Exception, ProcessingErrorInfo<TErrorContext>, Task>)method overloads. - Refactor
DelayIfNeedandDelayIfNeedAsyncmethods inDefaultRetryProcessor. - Introduced the
TryCatchBuilder.AddCatchBlock(Func<IEmptyCatchBlockFilter, NonEmptyCatchBlockFilter>, Action<IBulkErrorProcessor)method. - Introduced the
RetryProcessingErrorInfo<TParam>class along with related internal classes. - Applied DRY refactoring to
DefaultRetryProcessor– added a lazily initialized privateDelayProviderproperty. - Applied DRY refactoring to
ExceptionFilter-dependent classes by adding theAddIncludedErrorFilter<TException>andAddExcludedErrorFilter<TException>methods. - Applied DRY refactoring to
ExceptionFilter- dependent classes by adding theAddIncludedInnerErrorFilter<TException>andAddExcludedInnerErrorFilter<TException>methods.
Docs changes
- Update the 'Key Concepts' chapter in the README.
- Added a 'Key Concepts' section to the README.
Bumps and Dependency updates
- Bump Castle.Core from 5.1.1 to 5.2.1.
- Bump System.Runtime.CompilerServices.Unsafe and System.Threading.Tasks.Extensions.
- Bump System.Buffers from 4.6.0 to 4.6.1 .
2.21.0
Improvements
- Introduced the
FallbackPolicyBase.Handle<TErrorContext>(Action, TErrorContext, CancellationToken)andFallbackPolicyBase.Handle<TParam>(Action<TParam>, TParam, CancellationToken)methods. - Introduced the
FallbackPolicyBase.Handle<TParam, T>(Func<TParam, T>, TParam, CancellationToken)andFallbackPolicyBase.Handle<TErrorContext, T>(Func<T> func, TErrorContext param, CancellationToken)methods. - Introduced overloads for the
FallbackPolicyBase.HandleAsync<TParam>andFallbackPolicyBase.HandleAsync<TErrorContext>methods. - Introduced overloads for the
FallbackPolicyBase.HandleAsync<TParam, T>andFallbackPolicyBase.HandleAsync<TErrorContext, T>methods. - Introduced the
WithErrorContextProcessor<TErrorContext>andWithErrorContextProcessorOf<TErrorContext>method overloads forFallbackPolicy,FallbackPolicyBase,FallbackPolicyWithAction, andFallbackPolicyWithAsyncFuncpolicies. - Introduced the
DefaultFallbackProcessor.Fallback<TErrorContext>(Action, TErrorContext, Action<CancellationToken>, CancellationToken)method. - Introduced the
DefaultFallbackProcessor.Fallback<TParam>(Action<TParam>, TParam, Action<CancellationToken>)method. - Introduced the
DefaultFallbackProcessor.Fallback<TErrorContext, T>(Func<T>, TErrorContext, Func<CancellationToken, T>)method. - Introduced the
DefaultFallbackProcessor.Fallback<TParam, T>(Func<TParam, T>, TParam, Func<CancellationToken, T>, CancellationToken)method. - Introduced the
DefaultFallbackProcessor.FallbackAsync<TErrorContext>(Func<CancellationToken, Task>, TErrorContext, Func<CancellationToken, Task>, bool, CancellationToken)method. - Introduced the
DefaultFallbackProcessor.FallbackAsync<TParam>(Func<TParam, CancellationToken, Task>, TParam, Func<CancellationToken, Task>, bool, CancellationToken)method. - Introduced the
DefaultFallbackProcessor.FallbackAsync<TErrorContext, T>(Func<CancellationToken, Task<T>>, TErrorContext, Func<CancellationToken, Task<T>>, bool, CancellationToken)method. - Introduced the
DefaultFallbackProcessor.FallbackAsync<TParam, T>(Func<TParam, CancellationToken, Task<T>>, TParam, Func<CancellationToken, Task<T>>, bool, CancellationToken)method. - Introduced the
WithErrorContextProcessor<TErrorContext>(DefaultErrorProcessor<TErrorContext>)method inDefaultFallbackProcessor. - Introduced the
DefaultFallbackProcessor.WithErrorContextProcessorOf<TErrorContext>method overloads.
Small changes
DefaultRetryProcessorrefactoring - make the field representing the retry policy rule static and simplifyRetryErrorContextcreation.- Apply the 'check reference equality instead' Rider rule to type comparisons in the
DefaultRetryProcessor.RetryInternal<T>method.
Docs changes
- Update NuGet README.
- Updated 'Usage' in README for 2.20.0 changes.
- Update 'TryCatch' README Chapter.
- Update the Error processors chapter in the README.
- Add diagrams to README.
Bumps and Dependency updates
- Bump the nunit group with 7 updates.
2.20.0
Improvements
- Introduce the
DefaultErrorProcessor<TParam>,ProcessingErrorContext<TParam>andProcessingErrorInfo<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)andHandle<TErrorContext, T>(Func<T> func, TErrorContext param, CancellationToken)methods ofSimplePolicy. - Introduce overloads for the
SimplePolicy.HandleAsync<TParam>andSimplePolicy.HandleAsync<TErrorContext>methods. - Introduce overloads for the
SimplePolicy.HandleAsync<TParam, T>andSimplePolicy.HandleAsync<TErrorContext, T>methods. - Introduce the
SimplePolicy.WithErrorContextProcessor<TErrorContext>andSimplePolicy.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>andSimplePolicyProcessor.WithErrorContextProcessorOf<TErrorContext>method overloads. - Introduce the
Func<CancellationToken, Task<T>>.InvokeWithTryCatchAsyncextension method. - Introduce
InvokeWithTryCatchAsyncextension methods overloads for theFunc<CancellationToken, Task<T>>,Func<CancellationToken, Task>delegates. - Introduce the
Func<CancellationToken, Task>.InvokeWithTryCatchAsyncextension method. - Introduce the
Func<T>.InvokeWithTryCatchextension method. - Introduce the
Action.InvokeWithTryCatchextension method. - Introduce
TryCatchBuilder.AddCatchBlockmethod overloads withNonEmptyCatchBlockFilter,IBulkErrorProcessorparameters. - Introduce the
TryCatchBuilder.AddCatchBlockmethod overload with theNonEmptyCatchBlockFilterparameter. - Introduce the
TryCatchBuilder.AddCatchBlockmethod overload with theIBulkErrorProcessorparameter. - Introduce
TryCatchBuilder.CreateFrommethod overload withNonEmptyCatchBlockFilter,IBulkErrorProcessorparameters. - Introduce the
TryCatchBuilder.CreateFrommethod overload with theNonEmptyCatchBlockFilterparameter. - Introduce the
TryCatchBuilder.CreateFrommethod overload with theIBulkErrorProcessorparameter. - Introduce shorthand
TryCatchBuilder.CreateAndBuildmethod without parameters. - Introduce shorthand
TryCatchBuilder.CreateAndBuildmethod with theIBulkErrorProcessorparameter - Introduce shorthand
TryCatchBuilder.CreateAndBuildmethod with theFunc<Exception, Task>parameter. - Introduce shorthand
TryCatchBuilder.CreateAndBuildmethod with theAction<Exception>parameter.
Small changes
- Deprecate the
BulkErrorProcessor(PolicyAlias)constructor. - Made
PolicyProcessorconstructors that use thePolicyAliasparameter and the_isPolicyAliasSetfield obsolete. - Call the
ConfigureAwaitmethod in theErrorProcessorBase.ProcessAsyncmethod with theconfigAwaitparameter passed. - Add the internal class
EmptyErrorContext<TParam>. - Add the
Policy.HasPolicyWrapperFactoryinternal 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
Improvements
- Introduce
RetryPolicy.WithWait(DelayErrorProcessor)method. DefaultRetryProcessorrefactoring - add field representing retry policy rule.- Add the
RetryContext.IsZeroRetryproperty and use it to set thePolicyResult.NoErrorproperty to true. - Slightly improved performance for the
RetryPolicycustom error saver by passing theErrorContext<RetryContext>instead ofinttryCountarg in theDefaultRetryProcessor.SaveError(Async)methods. - Deprecate
ProcessingErrorContext.CurrentRetryCountproperty. - Introduce the
Policy.WrapPolicyCollectionextension method. - Argument exception guard clause for the
PolicyCollection.WrapUpmethod with theThrowOnWrappedCollectionFailed.Nonevalue for thethrowOnWrappedCollectionFailedparameter. - Argument exception guard clause for the
Policy.WrapPolicyCollectionmethod with theThrowOnWrappedCollectionFailed.Nonevalue for thethrowOnWrappedCollectionFailedparameter. - Made the
Policyclass constructorprotected(previouslyprivate protected). - Introduce
PolicyResultHandlerFailedException.Resultproperty. - Introduce
PolicyResultHandlerFailedException<T>exception.
Small changes
- Made the
cancellationTokenparameter optional inPolicyDelegate(<T>).HandleAsyncmethods. - Directly return Task instead of await when converting async uncancelable generic fallback delegate to cancelable with
CancellationType.Precancelableargument. - New tests for the
PolicyCollection.WrapUpmethod with theThrowOnWrappedCollectionFailed.CollectionErrorparameter. - New tests for a wrapped
SimplePolicythat wraps another policy. - Move the tests for the
RetryDelayclasses to a separate folder.
Docs changes
- Add doc comments to the public members of the
PolicyBuildingclass. - 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
Improvements
- Introduce
SlopeFactorforLinearRetryDelay. - Slightly improved performance for
RetryPolicyby removing the overhead of using theinttryCountargument in theDefaultRetryProcessor.DelayIfNeedAsync(Async)methods. - Introduce
PolicyCollection.WithRetry,PolicyCollection.WithInfiniteRetrymethods withRetryDelayparameter. - Introduce
PolicyDelegateCollection.WithRetry,PolicyDelegateCollection.WithInfiniteRetrymethods withRetryDelayparameter. - Introduce
PolicyDelegateCollection<T>.WithRetry,PolicyDelegateCollection<T>.WithInfiniteRetrymethods withRetryDelayparameter. - Introduce
RetryPolicy.SetPolicyResultFailedIfmethod overloads withAction<PolicyResult<T>>handler parameter forRetryPolicy,SimplePolicyandFallbackpolicies.
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
PolicyDelegateandPolicyDelegate<T>classes. - Add doc comments to the public members of the
PolicyDelegateResultandPolicyDelegateResult<T>classes. - Add doc comments to the public members of the
PolicyResultandPolicyResult<T>classes, and to thePolicyResultFailedReasonenum. - Update 'Calling Func and Action delegates in a resilient manner' README Chapter.
- Update 'RetryPolicy' README Chapter.
2.19.8
Improvements
- Introduce
Policyerror filtering extension methods in thePoliNorError.Extensions.PolicyErrorFilteringnamespace. - Fix issue #126 by using the
IDelayProvider.BackoffBackoffSafely(Async)extension methods. - Introduce
Action.InvokeWithRetryDelayextension methods. - Introduce
Action.InvokeWithRetryDelayInfiniteextension methods. - Introduce
Func<CancellationToken, Task>.InvokeWithRetryDelayAsyncextension methods. - Introduce
Func<CancellationToken, Task>.InvokeWithRetryDelayInfiniteAsyncextension methods. - Introduce
Func<T>.InvokeWithRetryDelayextension methods. - Introduce
Func<T>.InvokeWithRetryDelayInfiniteextension methods. - Introduce
Func<CancellationToken, Task<T>>.InvokeWithRetryDelayAsyncextension methods. - Introduce
Func<CancellationToken, Task<T>>.InvokeWithRetryDelayInfiniteAsyncextension methods.
Small changes
- Add early return in
RetryProcessor.Retry(Async)(<T>)methods if token is already canceled. - DRY Refactoring of the use of
RetryDelayinDefaultRetryProcessormethods. - 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.