Skip to content
ConsoleMonster

API Reference

Class

ExceptionView

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Implements
Modifiers sealed

An exception or PowerShell error, readable: the fail symbol and the type, the message, the PowerShell category, error id and position message, the script stack, the .NET frames as "Type.Method()" with shortened paths and file:line as links, framework frames collapsed into "+n framework frames", and the inner errors as "Caused by".

Inheritance

  • Object
  • ExceptionView

Usage

Explore 24 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 12

Constructors

ExceptionView 2 overloads
public ExceptionView(ExceptionInfo info) #

Creates the view of an error description.

Parameters

info ConsoleMonster.Widgets.ExceptionInfo requiredposition: 0
The description.
public ExceptionView(Exception exception) #

Creates the view of a .NET exception.

Parameters

exception System.Exception requiredposition: 0
The exception.

Methods

public List<StyledLine> Lines(Int32 width, RenderContext context) #
Returns: List<StyledLine>

The lines of the view at a width.

Parameters

width System.Int32 requiredposition: 0
The width.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
The render context.

Returns

The lines.

public Size Measure(Constraints constraints, RenderContext context) #
Returns: Size

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints requiredposition: 0
The space offered.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Returns

The desired size, never larger than the constraints.

public Void Render(Region region, RenderContext context) #
Returns: Void

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The target region.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.
public static String ShortMethod(String method) #
Returns: String

"Namespace.Type.Method(args)" as "Type.Method(args)"; script frames are left as they are.

Parameters

method System.String requiredposition: 0
The method.

Returns

The short form.

public String ShortPath(String path) #
Returns: String

A path relative to ExceptionView.BasePath when under it, otherwise the folder and file name.

Parameters

path System.String requiredposition: 0
The path.

Returns

The short path.

Properties

public Boolean ShowFrameworkFrames { get; set; } #

Shows framework frames instead of collapsing them.

public Int32 MaxFrames { get; set; } #

The most app frames shown per error (default 8); the rest are counted.

public Boolean ShowStack { get; set; } #

Shows the stack frames (default true); off shows the type, message and position only.

public Int32 MaxInner { get; set; } #

How many inner errors are shown (default 4).

public Boolean ShowSource { get; set; } #

Shows the source lines around the first app frame whose file can be read (default true), highlighted.

public String? BasePath { get; set; } #

The folder paths are shown relative to (default the current directory).

Extension Methods

public static ExceptionView WithBasePath(ExceptionView exceptionView, String? value) #
Returns: ExceptionView

Sets ExceptionView.BasePath: The folder paths are shown relative to (default the current directory).

Parameters

exceptionView ConsoleMonster.Widgets.ExceptionView requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.

public static ExceptionView WithMaxFrames(ExceptionView exceptionView, Int32 value) #
Returns: ExceptionView

Sets ExceptionView.MaxFrames: The most app frames shown per error (default 8); the rest are counted.

Parameters

exceptionView ConsoleMonster.Widgets.ExceptionView requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static ExceptionView WithMaxInner(ExceptionView exceptionView, Int32 value) #
Returns: ExceptionView

Sets ExceptionView.MaxInner: How many inner errors are shown (default 4).

Parameters

exceptionView ConsoleMonster.Widgets.ExceptionView requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static ExceptionView WithShowFrameworkFrames(ExceptionView exceptionView, Boolean value = true) #
Returns: ExceptionView

Sets ExceptionView.ShowFrameworkFrames: Shows framework frames instead of collapsing them.

Parameters

exceptionView ConsoleMonster.Widgets.ExceptionView requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.

public static ExceptionView WithShowSource(ExceptionView exceptionView, Boolean value = true) #
Returns: ExceptionView

Sets ExceptionView.ShowSource: Shows the source lines around the first app frame whose file can be read (default true), highlighted.

Parameters

exceptionView ConsoleMonster.Widgets.ExceptionView requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.

public static ExceptionView WithShowStack(ExceptionView exceptionView, Boolean value = true) #
Returns: ExceptionView

Sets ExceptionView.ShowStack: Shows the stack frames (default true); off shows the type, message and position only.

Parameters

exceptionView ConsoleMonster.Widgets.ExceptionView requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.