Git Product home page Git Product logo

Comments (5)

Lockszmith-GH avatar Lockszmith-GH commented on June 12, 2024

Thought it might do with capturing of the error stream, but this caused the same behavior:

$Prompt.Add( { $(try{throw "error"}catch{} *>&1)} )

from powerline.

Jaykul avatar Jaykul commented on June 12, 2024

You'll have to Set-PowerLinePrompt -HideErrors

PowerShell doesn't care that you're handling the error. I filed PowerShell/PowerShell#3768 about this years ago.

Basically, we're always invoking your scriptblock within a script cmdlet with -ErrorVariable, something like this:

. { [CmdletBinding()]param()
 try { throw "error" } catch {}
} -ErrorVariable logging

It doesn't matter that you handled the exception -- it still shows up in the ErrorVariable, and there's nothing I can do about it except ignore all the errors (the way I do, if you set -HideErrors true).

from powerline.

Lockszmith-GH avatar Lockszmith-GH commented on June 12, 2024

How about a way to ignore the error for a specific variable - base on output - or maybe even adding a custom object to the ErrorVariable?

I understand it's hacky as hell, but then again, sometimes a hack makes sense.

from powerline.

Lockszmith-GH avatar Lockszmith-GH commented on June 12, 2024

PowerShell doesn't care that you're handling the error. I filed PowerShell/PowerShell#3768 about this years ago.

Thanks for that.

One bizarre thread, a lively discussion, with an agreement from the PowerShell-committe throughout the course of a few month back in 2017.

Almost implemented in 2019, accepted by the committee once more in 2020, only to be dropped because of an overworked engineer.

Is this like this all the time? asking as you've been 'around the block' more than me.

from powerline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.