Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 619 Bytes

ExceptionHelpers.md

File metadata and controls

14 lines (9 loc) · 619 Bytes

Overview

There is one static method on the ExceptionHelpers type: PrepareForRethrow.

The purpose of this method is to preserve the original stack trace of the exception so that it is not overwritten when the exception is rethrown.

The return value of this method should always be thrown immediately; that is, every call to this method should look like this:

Exception ex = ...; // get saved exception
throw ExceptionHelpers.PrepareForRethrow(ex);

PrepareForRethrow uses ExceptionDispatchInfo.