Write ErrorRecord - PPOSHGROUP/PPoShTools GitHub Wiki
PPoShTools -> Write-ErrorRecord.ps1
Logs ErrorRecord message, including script StackTrace and exception StackTrace.
Write-ErrorRecord [[-ErrorRecord] <ErrorRecord>] [-NoThrow] [-PassThru]
[<CommonParameters>]
Error record to log. If null, $_ will be used.
- PipelineInput: false
- Required: false
If specified, exception will not be thrown at the end.
- DefaultValue: False
- PipelineInput: false
- Required: false
If specified, all log output will be available as return value.
- DefaultValue: False
- PipelineInput: false
- Required: false
$Global:ErrorActionPreference = 'Stop'
try { ... } catch { Write-ErrorRecord }