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
Copy file name to clipboardExpand all lines: Best-Practices/Error-Handling.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
When trapping an error, try to use -ErrorAction Stop on cmdlets to generate terminating, trappable exceptions.
4
4
5
-
# ERR-02 Use $ErrorActionPreference='Stop' or 'Continue' when calling non-cmdlets
5
+
# ERR-02 Use $ErrorActionPreference = 'Stop' or 'Continue' when calling non-cmdlets
6
6
7
-
When executing something other than a cmdlet, set $ErrorActionPreference='Stop' before executing, and re-set to Continue afterwards. If you're concerned about using -ErrorAction because it will bail on the entire pipeline, then you've probably over-constructed the pipeline. Consider using a more scripting-construct-style approach, because those approaches are inherently better for automated error handling.
7
+
When executing something other than a cmdlet, set $ErrorActionPreference = 'Stop' before executing, and re-set to Continue afterwards. If you're concerned about using -ErrorAction because it will bail on the entire pipeline, then you've probably over-constructed the pipeline. Consider using a more scripting-construct-style approach, because those approaches are inherently better for automated error handling.
8
8
9
9
Ideally, whatever command or code you think might bomb should be dealing with one thing: querying one computer, deleting one file, updating one user. That way, if an error occurs, you can handle it and then get on with the next thing.
Copy file name to clipboardExpand all lines: Best-Practices/TODO.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -149,8 +149,8 @@ It doesn't do anything, and it confuses future readers.
149
149
When prompted for a mandatory parameter, a user can request HelpText, but can't look at the documentation. It's frequently useful to duplicate at least the first sentence or two of the parameter help.
0 commit comments