Skip to content

Releases: gravity00/SimpleExceptionHandling

Release v1.1.0

28 Aug 21:09
Compare
Choose a tag to compare

Release v1.1.0

The SimpleExceptionHandling package version 1.1.0 has been released and can be downloaded from NuGet via the following command:

Install-Package SimpleExceptionHandling -Version 1.1.0

Release notes

1. Added support for more frameworks

The library now supports the following frameworks:

  • MonoAndroid 1.0;
  • MonoTouch 1.0;
  • .NET Framework 2.0
  • .NET Framework 3.5
  • .NET Framework 4.0
  • .NET Framework 4.5
  • .NET Core 5.0;
  • .NET Standard 1.0;
  • Portable Class Library (.NETFramework 4.0, Silverlight 5.0, Windows 8.0, WindowsPhone 8.0, WindowsPhoneApp 8.1);
  • Portable Class Library (.NETFramework 4.5, Windows 8.0, WindowsPhoneApp 8.1);
  • WindowsPhoneApp 8.1;
  • Xamarin.iOS 1.0;
  • Xamarin.TVOS 1.0;

2. Implemented a finalization handler with a behavior similar to try-finally

The library now supports a finalization handler. Example:

string handlerName = null;
var configuration =
    Handling.Prepare()
        .On<ArgumentNullException>(ex =>
        {
            handlerName = $"ArgumentNullException[ParamName={ex.ParamName}]";
        })
        .On<ArgumentException>(ex =>
        {
            handlerName = $"ArgumentException[ParamName={ex.ParamName}]";
        })
        .FinalizeWith((ex, i, r) =>
        {
            Console.WriteLine("This is the finalization handler");
        });

Note: keep in mind that exceptions thrown in this handler will override exceptions thrown by other handlers or the original exception if throwIfNotHandled = true. This is the same behavior as the finally block.