@@ -16,18 +16,18 @@ _To contribute, check out our [guide here](#contributing)._
16
16
17
17
| Table of Contents |
18
18
| :------------------|
19
- | [ AssertMock] ( #assertmock ) : _ Creates assert mock Pester test_ |
19
+ | [ AssertMock] ( #assert_mock ) : _ Creates assert mock Pester test_ |
20
20
| [ CalculatedProperty] ( #calculatedproperty ) : _ Create a calculated property for use in a select-object call by @corbob_ |
21
21
| [ DataTable] ( #datatable ) : _ Creates a DataTable_ |
22
22
| [ DateTimeWriteVerbose] ( #datetimewriteverbose ) : _ Write-Verbose with the time and date pre-pended to your message by @ThmsRynr_ |
23
+ | [ Error-Terminating] ( #error-terminating ) : _ Create a full terminating error by @omniomi_ |
23
24
| [ IfShouldProcess] ( #ifshouldprocess ) : _ Added If Should Process_ |
24
25
| [ MaxColumnLengthinDataTable] ( #maxcolumnlengthindatatable ) : _ Gets the max length of string columns in datatables_ |
25
26
| [ Parameter-Credential] ( #parameter-credential ) : _ Add a standard credential parameter to your function by @omniomi_ |
26
27
| [ PesterTestForMandatoryParameter] ( #pestertestformandatoryparameter ) : _ Create Pester test for a mandatory parameter_ |
27
28
| [ PesterTestForParameter] ( #pestertestforparameter ) : _ Create Pester test for parameter_ |
28
29
| [ PSCustomObject] ( #pscustomobject ) : _ A simple PSCustomObject by @brettmillerb_ |
29
30
30
-
31
31
## Snippets
32
32
33
33
### Assert Mock
@@ -118,6 +118,24 @@ Quickly add a `Write-Verbose` with the current date and time inserted before the
118
118
}
119
119
```
120
120
121
+ ### Error-Terminating
122
+
123
+ Quickly add a fully defined error record and throw. by @omniomi
124
+
125
+ ``` json
126
+ "Throw Terminating Error" : {
127
+ "prefix" : " error-terminating" ,
128
+ "body" : [
129
+ " \\ $Exception = New-Object ${1:System.ArgumentException} (\" ${2:Invalid argument provided.}\" )\r " ,
130
+ " \\ $ErrorCategory = [System.Management.Automation.ErrorCategory]::${3:InvalidArgument}\r " ,
131
+ " # Exception, ErrorId as [string], Category, and TargetObject (e.g. the parameter that was invalid)\r " ,
132
+ " \\ $ErrorRecord = New-Object System.Management.Automation.ErrorRecord(\\ $Exception, '${4:InvalidArgument}', \\ $ErrorCategory, ${5:\\ $null})\r " ,
133
+ " \\ $PSCmdlet.ThrowTerminatingError(\\ $ErrorRecord)"
134
+ ],
135
+ "description" : " Throw a full terminating error."
136
+ }
137
+ ```
138
+
121
139
### IfShouldProcess
122
140
123
141
Add If Should Process with easy tab inputs
0 commit comments