Skip to content

Commit 529c54d

Browse files
committed
Add explanation to ErrorRecordExtensions
1 parent ba52e84 commit 529c54d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PowerShellEditorServices/Services/PowerShell/Utility/ErrorRecordExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ static ErrorRecordExtensions()
2424

2525
var errorObjectParameter = Expression.Parameter(typeof(PSObject));
2626

27+
// Generates a call like:
28+
// $errorPSObject.WriteStream = [System.Management.Automation.WriteStreamType]::Error
29+
// So that error record PSObjects will be rendered in the console properly
2730
s_setWriteStreamProperty = Expression.Lambda<Action<PSObject>>(
2831
Expression.Call(
2932
errorObjectParameter,
3033
writeStreamProperty.GetSetMethod(),
31-
Expression.Constant(errorStreamType)),
34+
Expression.Constant(errorStreamType)),
3235
errorObjectParameter)
3336
.Compile();
3437
}

0 commit comments

Comments
 (0)