ExceptionExtensions ClassDelta Engine Documentation
Categorizes exceptions into fatal and weak ones. Fatal exceptions are always rethrown and weak ones (most likely simple programming mistakes) can be logged and ignored if no debugger is attached. See http://vasters.com/clemensv/2012/09/06/Are+You+Catching+Falling+Knives.aspx View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Extensions ExceptionExtensions

Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public static class ExceptionExtensions

The ExceptionExtensions type exposes the following members.

Methods

  NameDescription
Public methodStatic memberIsFatal
Public methodStatic memberIsWeak
Top
Properties

  NameDescription
Public propertyStatic memberIsDebugMode
Top
Remarks

Tests: DeltaEngine.Tests.Extensions.ExceptionExtensionsTests
Examples

5 unit tests call DeltaEngine.Extensions.ExceptionExtensions
[Test]
public void CheckForFatalException()
{
    Assert.IsFalse(new Exception().IsFatal());
    Assert.IsTrue(new Exception("", new InvalidOperationException()).IsFatal());
    Assert.IsTrue(new InvalidOperationException().IsFatal());
    Assert.IsTrue(new OutOfMemoryException().IsFatal());
    Assert.IsTrue(new AccessViolationException().IsFatal());
    Assert.IsTrue(new StackOverflowException().IsFatal());
    Assert.IsTrue(new TargetInvocationException(null).IsFatal());
    Assert.IsFalse(new NullReferenceException(null).IsFatal());
}
[Test]
public void CheckForWeakException()
{
    Assert.IsFalse(new Exception().IsWeak());
    Assert.IsTrue(new ArgumentNullException().IsWeak());
}
[Test]
public void MakeSureFatalExceptionsAreRethrown()
{
    try
    {
        TryMakeSureFatalExceptionsAreRethrown();
    } // ncrunch: no coverage 
    catch (Exception ex)
    {
        Assert.IsTrue(ex.IsFatal());
    }
}
See Also