Closed johlju closed 7 months ago
This should take parameters
Exception
that can be assigned any exception (uses type [Exception]
if possible)ErrorCategory
that uses the type [System.Management.Automation.ErrorCategory]
TargetObject
that specifies any object that failed.ErrorId
that can be set to any string value that uniquely identifies this error.New-Object -TypeName 'System.Management.Automation.ErrorRecord' -ArgumentList = @(
$Exception,
$ErrorId
$ErrorCategory,
$TargetObject
)
Problem description
Suggest adding a new command that returns an ErrorObject. It can be re-used by all the commands
New-*Exception
commands in this module.It would also help to return an ErrorObject when using Write-Error.
Verbose logs
How to reproduce
n/a
Expected behavior
Return an error record object.
Current behavior
Does not exist.
Suggested solution
By implementing issue #98 and what this issue suggest we could do:
Operating system the target node is running
PowerShell version and build the target node is running
Module version used