Private/New-OperationValidationFailure.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

function New-OperationValidationFailure {
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Scope='Function', Target='*')]
    param (
        [Parameter(Mandatory)]
        [string]$StackTrace,

        [Parameter(Mandatory)]
        [string]$FailureMessage
    )

    $o = [pscustomobject]@{
        PSTypeName     = 'OperationValidationFailure'
        StackTrace     = $StackTrace
        FailureMessage = $FailureMessage
    }
    $toString = { return $this.StackTrace }
    Add-Member -Inputobject $o -MemberType ScriptMethod -Name ToString -Value $toString -Force
    $o
}