Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7abbe9b

Browse files
committedApr 30, 2018
fix merge conflict
2 parents ce42d6b + daba6b7 commit 7abbe9b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed
 

‎docs/community_snippets.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ _To contribute, check out our [guide here](#contributing)._
1616

1717
| Table of Contents |
1818
|:------------------|
19-
| [AssertMock](#assertmock): _Creates assert mock Pester test_ |
19+
| [AssertMock](#assert_mock): _Creates assert mock Pester test_ |
2020
| [CalculatedProperty](#calculatedproperty): _Create a calculated property for use in a select-object call by @corbob_ |
2121
| [DataTable](#datatable): _Creates a DataTable_ |
2222
| [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_ |
2324
| [IfShouldProcess](#ifshouldprocess): _Added If Should Process_ |
2425
| [MaxColumnLengthinDataTable](#maxcolumnlengthindatatable): _Gets the max length of string columns in datatables_ |
2526
| [Parameter-Credential](#parameter-credential): _Add a standard credential parameter to your function by @omniomi_ |
2627
| [PesterTestForMandatoryParameter](#pestertestformandatoryparameter): _Create Pester test for a mandatory parameter_ |
2728
| [PesterTestForParameter](#pestertestforparameter): _Create Pester test for parameter_ |
2829
| [PSCustomObject](#pscustomobject): _A simple PSCustomObject by @brettmillerb_ |
2930

30-
3131
## Snippets
3232

3333
### Assert Mock
@@ -118,6 +118,24 @@ Quickly add a `Write-Verbose` with the current date and time inserted before the
118118
}
119119
```
120120

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+
121139
### IfShouldProcess
122140

123141
Add If Should Process with easy tab inputs

0 commit comments

Comments
 (0)
Please sign in to comment.