ConciseView
error view mangles ParseException
child classes with custom message
#21469
Closed
5 tasks done
Labels
Issue-Enhancement
the issue is more of a feature request than a bug
Resolution-By Design
The reported behavior is by design.
WG-Interactive-Console
the console experience
Prerequisites
Steps to reproduce
The implementation of ConciseView has special handling for rendering parser errors: https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs#L1223
However, the code assumes that anything with
CategoryInfo
equal toParserError
is aParseException
and assumes that the format of the error message exactly matches theMessage
property of aParseException
.In my code, I'm parsing custom PowerShell data files and throwing an exception class inheriting from
ParseException
, with added source position metadata in the error message. This results in confusing error messages when the exception is rendered using ConciseView.I would prefer if the special rendering was only triggered for
ParseException
, and not for subclasses.Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: