Skip to content
ConsoleMonster
Cmdlet

Format-ConsoleError

Module ConsoleMonster
Inputs
System.Object
Outputs
ConsoleMonster.Layout.IWidget

Shows errors and exceptions readably: type, message, position, script stack, frames and inner errors.

Syntax

Format-ConsoleError [-AsWidget] [[-InputObject] <Object>] [-MaxFrames <Int32>] [-NoStack] [-ShowFrameworkFrames] [-Width <Int32>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Shows errors and exceptions readably: type, message, position, script stack, frames and inner errors.

Takes ErrorRecords (from $Error, $_ in a catch block, -ErrorVariable) and .NET exceptions from the pipeline. Each shows the type and the message, the category and error id, PowerShell's position message with the failing line, the script stack, the .NET frames as Type.Method() with shortened paths and file:line links, framework frames collapsed into "+n framework frames", and the inner exceptions as "Caused by". With -AsWidget the views are returned for New-ConsolePanel, dashboards or Export-ConsoleFrame instead of written. Redirected output is plain text.

Examples

Authored help example

EXAMPLE 1

Format-ConsoleError -AsWidget

Parameters

-AsWidget SwitchParameter optional
Returns the views instead of writing them.
-InputObject Object optionalposition: 0pipeline: True (ByValue)
An ErrorRecord, an exception or a message (pipeline input).
-MaxFrames Int32 optional
The most app frames shown per error (default 8).
-NoStack SwitchParameter optional
Leaves out the stack frames: type, message and position only.
-ShowFrameworkFrames SwitchParameter optional
Shows framework frames (System, Microsoft, the PowerShell engine) instead of collapsing them.
-Width Int32 optional
Lays the output out for this width instead of the terminal's.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.