You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With these two lines you will fail fast, hard and consistently (the users ErrorActionPreference will not matter).
I write Python quite often and would like to quote parts of The Zen of Python:
Errors should never pass silently.
Unless explicitly silenced.
I believe any PowerShell script also should behave this way. Silent errors can and will lead to nothing but confusion and frustrating debug situations.
The text was updated successfully, but these errors were encountered:
In ERR-01 and ERR-02 you're told to use -ErrorAction on all cmdlets and set ErrorActionPreference around everything else, where needed.
This leaves it to the scripter to figure out how every command emits its errors and how they're emitted. I believe this is impossible.
Personally I put this in the first two lines of the begin block in every advanced function I create:
With these two lines you will fail fast, hard and consistently (the users ErrorActionPreference will not matter).
I write Python quite often and would like to quote parts of The Zen of Python:
I believe any PowerShell script also should behave this way. Silent errors can and will lead to nothing but confusion and frustrating debug situations.
The text was updated successfully, but these errors were encountered: