public static Exception PreserveStackTrace(this Exception ex, string stepName = null) { // Silverlight can't do the private reflection required to preserve the // stack trace, and since we have to store and rethrow this exception, // we have no choice but to wrap it, but make sure we don't wrap it more // than once if (!(ex is ScenarioErrorException)) ex = new ScenarioErrorException(stepName, ex); return ex; }
public static Exception PreserveStackTrace(this Exception ex, string stepName = null) { // Silverlight can't do the private reflection required to preserve the // stack trace, and since we have to store and rethrow this exception, // we have no choice but to wrap it, but make sure we don't wrap it more // than once if (!(ex is ScenarioErrorException)) { ex = new ScenarioErrorException(stepName, ex); } return(ex); }