external help file: PoshToolbox-help.xml Module Name: PoshToolbox online version: https://gitlab.com/PoshAJ/PoshToolbox/-/blob/main/docs/New-Exception.md schema: 2.0.0
Creates an instance of ErrorRecord.
New-Exception [-Message] <String> [-Throw] [<CommonParameters>]
The New-Exception
function creates an ErrorRecord object for an exception with the specified message.
Specifies the message text of the exception.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies to generate a terminating error.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This function supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You cannot pipe input to this function.
Returns an ErrorRecord object for the specified message.