Skip to content

Commit 78e81ec

Browse files
Copilotjohlju
andcommitted
Fix inconsistency in state-changing commands table row
Co-authored-by: johlju <[email protected]>
1 parent 78ecf3a commit 78e81ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ $results = $items | Process-Items -ErrorAction 'Stop'
614614
| Single cmdlet error handling | Use `-ErrorAction 'Stop'` on the cmdlet | Simpler and more explicit than setting `$ErrorActionPreference` |
615615
| Calling commands that use ThrowTerminatingError | Set `$ErrorActionPreference = 'Stop'` in caller OR wrap in try-catch | Using `-ErrorAction 'Stop'` alone is NOT sufficient; caller continues after error |
616616
| Assert-style commands | `$PSCmdlet.ThrowTerminatingError()` | Command purpose is to throw on failure |
617-
| State-changing commands (catch blocks) | `$PSCmdlet.ThrowTerminatingError()` | Prevents partial state changes; caller must use `-ErrorAction 'Stop'` or set `$ErrorActionPreference` |
617+
| State-changing commands (catch blocks) | `$PSCmdlet.ThrowTerminatingError()` | Prevents partial state changes; caller must set `$ErrorActionPreference = 'Stop'` OR wrap in try-catch |
618618
| Private functions (internal use only) | `$PSCmdlet.ThrowTerminatingError()` or `Write-Error` | Behavior is understood by internal callers |
619619
| Parameter validation in `[ValidateScript()]` | `throw` | Only valid option within validation attributes |
620620
| Any other scenario in commands | Never use `throw` | Poor error messages; unpredictable behavior |

0 commit comments

Comments
 (0)