镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

ErrorView should support a custom ErrorView #4

Open

Description

@StartAutomating

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 .

Activity

  1. Jaykul commented on Sep 22, 2024

    @Jaykul
    Member

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions