PoliNorError 2.24.20
dotnet add package PoliNorError --version 2.24.20
NuGet\Install-Package PoliNorError -Version 2.24.20
<PackageReference Include="PoliNorError" Version="2.24.20" />
<PackageVersion Include="PoliNorError" Version="2.24.20" />
<PackageReference Include="PoliNorError" />
paket add PoliNorError --version 2.24.20
#r "nuget: PoliNorError, 2.24.20"
#:package PoliNorError@2.24.20
#addin nuget:?package=PoliNorError&version=2.24.20
#tool nuget:?package=PoliNorError&version=2.24.20
PoliNorError is a library that provides error handling capabilities through Retry and Fallback policies or processors.
Also provides SimplePolicy and TryCatch mimicking.
The library can also handle potential exceptions within the catch block and offers various configuration options.
var result =
new RetryPolicy(2)
.IncludeError<SomeException>()
.WithErrorProcessorOf((Exception ex, ProcessingErrorInfo pi) =>
logger.LogError(ex,
"Policy processed exception on {Attempt} attempt:",
pi.GetRetryCount() + 1))
.AddPolicyResultHandler((PolicyResult pr) =>
logger.LogWarning(
"{Errors} exceptions were thrown.",
pr.Errors.Count()))
.Handle(ActionThatCanThrowSomeException);
var simplePolicyResult = new SimplePolicy()
.WithErrorContextProcessorOf<int>((ex, pi) =>
loggerTest.LogError(ex,
"Delegate call with parameter value {Param} failed with an exception.",
pi.Param))
//If the random value is zero,
//the previous line of code
//logs an error with {Param} set to zero.
.Handle((i) => 5 / i, random);
var retryPolicyResult = await new RetryPolicy(5)
.WithErrorContextProcessorOf<string>((ex, pi) =>
logger.LogError(ex,
"Failed to connect to {Uri} on attempt {Attempt}.",
pi.Param,
pi.GetAttemptCount()))
//In case of an exception,
//the previous line logs an error
//with {Uri} set to "users"
//and {Attempt} set to the current attempt
.HandleAsync(async (uri, ct)
=> await _httpClient.GetAsync(uri, ct), "users", token);
//Implementation of the Retry-Then-Fallback pattern:
// Create a retry policy that will attempt the operation up to 3 times.
var fallbackResult = new RetryPolicy(3)
// Exclude DivideByZeroException from being retried.
.ExcludeError<DivideByZeroException>()
// Switch to a fallback policy that wraps up the current retry policy.
.ThenFallback()
// Configure the fallback policy using a function that returns int.MaxValue.
.WithFallbackFunc(() => int.MaxValue)
// The fallback policy exclusively handles DivideByZeroException.
.IncludeError<DivideByZeroException>()
// Log an error message when fallback is triggered
.WithErrorProcessorOf(_ => logger.LogError("Fallback to int.MaxValue"))
// If the random value is zero,
// the fallback is triggered,
// "Fallback to int.MaxValue" is logged,
// and fallbackResult.Result is set to int.MaxValue.
.Handle(() => 5 / random);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on PoliNorError:
| Package | Downloads |
|---|---|
|
PoliNorError.Extensions.Http
The library provides an outgoing request resiliency pipeline for `HttpClient`, using policies from the PoliNorError library. |
|
|
PoliNorError.Extensions.DependencyInjection
The PoliNorError.Extensions.DependencyInjection package extends PoliNorError library to provide integration with Microsoft Dependency Injection. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.24.20 | 173 | 12/24/2025 |
| 2.24.12 | 332 | 9/21/2025 |
| 2.24.0 | 222 | 7/7/2025 |
| 2.23.0 | 258 | 5/11/2025 |
| 2.22.0 | 599 | 3/26/2025 |
| 2.21.0 | 253 | 2/9/2025 |
| 2.20.0 | 183 | 12/25/2024 |
| 2.19.15 | 169 | 11/17/2024 |
| 2.19.11 | 195 | 10/16/2024 |
| 2.19.8 | 187 | 9/22/2024 |
| 2.19.5 | 180 | 8/20/2024 |
| 2.19.0 | 206 | 7/24/2024 |
| 2.18.14 | 192 | 7/1/2024 |
| 2.18.11 | 186 | 6/8/2024 |
| 2.18.4 | 193 | 5/22/2024 |
| 2.18.0 | 194 | 4/30/2024 |
| 2.17.0 | 181 | 4/15/2024 |
| 2.16.21 | 203 | 3/27/2024 |
| 2.16.20 | 213 | 3/26/2024 |
| 2.16.16 | 204 | 3/11/2024 |
| 2.16.15 | 209 | 3/10/2024 |
| 2.16.9 | 216 | 2/26/2024 |
| 2.16.1 | 216 | 2/11/2024 |
| 2.15.0 | 222 | 1/21/2024 |
| 2.14.0 | 227 | 1/7/2024 |
| 2.12.1 | 240 | 12/24/2023 |
| 2.11.1 | 204 | 12/10/2023 |
| 2.10.0 | 167 | 11/27/2023 |
| 2.9.1 | 185 | 11/12/2023 |
| 2.8.1 | 206 | 10/21/2023 |
| 2.6.1 | 208 | 10/9/2023 |
| 2.4.0 | 181 | 9/24/2023 |
| 2.0.5 | 222 | 9/10/2023 |
| 2.0.0 | 244 | 8/24/2023 |
| 2.0.0-rc5 | 227 | 8/12/2023 |
| 2.0.0-rc4 | 198 | 8/6/2023 |
| 2.0.0-rc3 | 228 | 7/23/2023 |
| 2.0.0-rc2 | 226 | 7/9/2023 |
| 2.0.0-rc | 238 | 6/18/2023 |
| 2.0.0-alpha | 223 | 6/12/2023 |
| 1.0.4 | 272 | 5/21/2023 |
| 1.0.3 | 246 | 5/14/2023 |
| 1.0.1 | 265 | 5/8/2023 |
| 1.0.0 | 249 | 5/8/2023 |