I have a cmdlet named update-name which throws a ThrowTerminatingError when it encounters an exception. This works fine. But when I do get-name | update-name and if in this case an error occurs, it results in an exception :
System.Management.Automation.PipelineStoppedException: The pipeline has been stopped.at System.Management.Automation.CommandProcessor.ProcessRecord()
at System.Management.Automation.CommandProcessorBase.DoExecute()
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.Management.Automation.MshCommandRuntime.WriteObject(Object sendToPi
peline)
at System.Management.Automation.Cmdlet.WriteObject(Object sendToPipeline)
Thus the exception is shown on the screen only when the input is given from a pipeline. Otherwise it works fine. I am not able to understand this behaviour. Can somebody help?