How Can We Help?
< Back
You are here:

Try-Catch and $_

Be aware that the pipeline variable ($_) in the Catch block of a Try-Catch construct, does NOT contain the original pipeline value, but rather the error on which the Catch block was entered.

So if you do this

The $_ variable in the Catch block will contain the error.

Avoid this by doing for example


Next Use Try-Catch

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Table of Contents