public void ThrowTerminatingError(ErrorRecord errorRecord) { if (CommandRuntime == null) { if (errorRecord.Exception != null) { throw errorRecord.Exception; } throw new InvalidOperationException(errorRecord.ToString()); } CommandRuntime.ThrowTerminatingError(errorRecord); }