Error handling clarification

The Error Handling Github issue makes a distinction with Statement -terminating errors between Non-terminating errors and Terminating errors.

How is a Non-terminating error any different from a Statement -terminating error?

As far as I can tell, real PowerShell errors (versus those generated by executables etc) fall into two categories, statement terminating or script terminating?

What is an example of a non-terminating error that processes the current item in the pipeline?

Get-ChildItem is a common one. Plenty of access denied but it keeps trucking by default

Right, so that is a statement terminating error, the pipeline continues but the object in the current context was aborted.

I am trying to understand what was meant by a non-terminating error?

I think that was maybe a semantic error in the Github issue? Either an error terminates the statement or the script, right?

The most in depth understanding I can offer you comes from Michael Klement on Github/Stackoverflow. Here is a very detailed post

https://github.com/MicrosoftDocs/PowerShell-Docs/issues/1583

Here are a few pages worth looking over

https://github.com/PowerShell/PowerShell/issues/6098
https://github.com/PowerShell/PowerShell/issues/14819

1 Like