Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorView should support a custom ErrorView #4

Open
StartAutomating opened this issue Sep 22, 2024 · 1 comment
Open

ErrorView should support a custom ErrorView #4

StartAutomating opened this issue Sep 22, 2024 · 1 comment
Labels
invalid This doesn't seem right

Comments

@StartAutomating
Copy link

It would be nice if the error view was easy to customize.

Here's a slight suggestion as to how:

If $env:ErrorView is set, it should be treated as an expandable PowerShell string.

If it is present, it should take precedence over #2 and #3 .

@Jaykul
Copy link
Member

Jaykul commented Sep 22, 2024

Obviously, the whole point of the module is for the ErrorView to be easy to customize, and I think it already is:

  1. Write a function ConvertTo-WhateverErrorview that takes n $InputObject parameter of type [System.Management.Automation.ErrorRecord]
  2. Call Set-ErrorView Whatever or Import-Module ErrorView -Args Whatever

Additionally, the module already supports an ErrorView argument at import, and although it would be simple to make that consider an environment variable, I'm not sure I see the need, since you have to define a function anyway.

I can't imagine any useful way to format an error with a single string, so would you care to give an example?

@Jaykul Jaykul added the invalid This doesn't seem right label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants