Table of Contents

Class ExceptionExtensions

Namespace
Shift.Common
Assembly
Shift.Common.dll
public static class ExceptionExtensions
Inheritance
ExceptionExtensions
Inherited Members

Methods

FromHierarchy<TSource>(TSource, Func<TSource, TSource>)

Traverses a hierarchy of reference types until null is encountered.

public static IEnumerable<TSource> FromHierarchy<TSource>(this TSource source, Func<TSource, TSource> nextItem) where TSource : class

Parameters

source TSource
nextItem Func<TSource, TSource>

Returns

IEnumerable<TSource>

Type Parameters

TSource

FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, bool>)

Traverses a hierarchy of objects using a selector function until a condition is met.

public static IEnumerable<TSource> FromHierarchy<TSource>(this TSource source, Func<TSource, TSource> nextItem, Func<TSource, bool> canContinue)

Parameters

source TSource
nextItem Func<TSource, TSource>
canContinue Func<TSource, bool>

Returns

IEnumerable<TSource>

Type Parameters

TSource

GetAllExceptions(Exception)

Gets all exceptions in the hierarchy, including AggregateException inner exceptions.

public static IEnumerable<Exception> GetAllExceptions(this Exception exception)

Parameters

exception Exception

Returns

IEnumerable<Exception>

GetAllMessages(Exception)

Gets all exception messages concatenated with newlines.

public static string GetAllMessages(this Exception exception)

Parameters

exception Exception

Returns

string

GetFormattedMessages(Exception)

Gets all exception messages formatted as Markdown with hierarchical bullet points.

public static string GetFormattedMessages(this Exception exception)

Parameters

exception Exception

Returns

string

GetMessages(Exception)

Gets all exception messages as an enumerable sequence.

public static IEnumerable<string> GetMessages(this Exception exception)

Parameters

exception Exception

Returns

IEnumerable<string>