Skip to content

CrescendoNativeErrorQueue and -ErrorAction Stop #188

@MTI-gh

Description

@MTI-gh

Summary of the new feature / enhancement

I updated a module to use v1.1 and handle errors using Pop-CrescendoNativeError -EmitAsError.
The command-line tool quser.exe sends two error messages when a remote machine cannot be reached so this puts two messages in the __CrescendoNativeErrorQueue.

When using the -ErrorAction Stop parameter on the function it will trigger on the first error as expected. However the second message is still in the ErrorQueue. The next time the command is run, it will spit out that remaining error message even if the command is succesful.

I've tried to illustrate the behaviour in the screenshots.
ErrorFromCLi
Example

Proposed technical implementation details (optional)

It's open for discussion on whether this is an issue that needs to be solved or if the onus is on us to make changes according to our needs for the module.
Right now, to solve the problem I tweaked the function Pop-CrescendoNativeError to group multiple messages into 1 and write the errormessage only when the CrescendoNativeErrorQueue is empty.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions