dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 788 forks source link

Multiple Functions - Remove Stop-Function ErrorRecord parameter use outside of try-catch blocks #9227

Closed 0x7FFFFFFFFFFFFFFF closed 4 months ago

0x7FFFFFFFFFFFFFFF commented 5 months ago

This commit fixes a bug where $_, which should only reference the caught error object within catch blocks, was incorrectly used in Stop-Function calls outside of catch blocks. This could lead to unexpected behavior as $_ would incorrectly refer to the current object in the pipeline rather than the intended error object. The Stop-Function calls have been updated to remove the erroneous reference to ensure error handling behaves as expected.

Please read -- recent changes to our repo

On November 10, 2022, we removed some bloat from our repository (for the second and final time). This change requires that all contributors reclone or refork their repo.

PRs from repos that have not been recently reforked or recloned will be closed and @potatoqualitee will cherry-pick your commits and open a new PR with your changes.

Type of Change

potatoqualitee commented 4 months ago

Oh, man. Wonderful change, thank you so mu ch!