GithubHelp home page GithubHelp logo

Comments (5)

RamblingCookieMonster avatar RamblingCookieMonster commented on August 21, 2024

Hi! I suspect this and #36 are the same - the code that handles this looks at the error stream and writes out any errors that it finds.

There might be a way to work around this, but I haven't run into too many show-stoppers at work (typically triggers for spending more significant amount of time digging in) - Have you tried @proxb's PoshRSJob? Boe writes fantastic code, and that module has become the communities de facto runspace abstraction, so it might be worth seeing if they implement it there.

Totally open to pull requests if you find the cause and prefer to keep using this.

Cheers!

from invoke-parallel.

avishnyakov avatar avishnyakov commented on August 21, 2024

the code that handles this looks at the error stream

Right but the thing is that there are gazillion scripts / functions called underneath. Indeed there is an error but where and how to understand the exact place of the error?

Alright, got the message. Will evaluate PoshRSJob stopping asking anything here.

from invoke-parallel.

RamblingCookieMonster avatar RamblingCookieMonster commented on August 21, 2024

Ahh, I gotcha!

So, if there's no way around it, you could take several approaches, for example:

  • Catch errors, throw your own (perhaps in addition to the real error), include necessary context to allow tracing back
  • log errors to an external system - a file, event log, database, logging system, etc. Include necessary info to debug from there

I'm curious, will take a peak at Boe's code, if there's a way around this I'm assuming it will be implemented there, but there's a good chance it will be a bit over my head : )

Cheers!

from invoke-parallel.

RamblingCookieMonster avatar RamblingCookieMonster commented on August 21, 2024

Yep, similar issue:

Start-RSJob -ScriptBlock {throw 'wat'} | Wait-RSJob | Receive-RSJob
WriteStream : Exception calling "EndInvoke" with "1" argument(s): "wat"
At C:\Program Files\WindowsPowerShell\Modules\PoshRSJob\1.7.0.0\Public\Receive-RSJob.ps1:102 char:18
+             $_ | WriteStream
+                  ~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,WriteStream

PowerShell is trying to be helpful and gives us details on where the error is emitted - the problem is that we're reading from the error stream, and re-writing the error from these runspace abstraction tools - thus you get context about where the error is seen in the runspace abstraction tool, not your code.

The workarounds I mentioned above (catch and write contextful errors, or log errors to external system) will likely be your best bet.

Cheers!

from invoke-parallel.

avishnyakov avatar avishnyakov commented on August 21, 2024

Sure, might work well. Thanks!

from invoke-parallel.

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.