(#967) Parse Info messages for errors #1042
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description Of Changes
This updates the handling of messages from Chocolatey.Lib to parse for ERROR, WARN, and FATAL messages and include them in the error message.
Motivation and Context
When run through self service, Chocolatey Agent calls Chocolatey CLI and reports back the results. Due to this, all messages are output on Standard Output.
Testing
In order to test this, you need to check out the PRs mentioned at the bottom. This is due to some minor debug specific changes to the projects other projects. To try and make setup and debugging easier, I've added some files to a gist: https://gist.github.com/corbob/e1d021ccec9586a9e85061ee077b55dd
For the purposes of testing this, all repositories were checked out into
C:\git
. You can check them out wherever you normally have them checked out, just adjust samples accordingly. I have also added a source location calledlocal
that is mapped toC:\packages
and contains thethrows-message
package from the gist. Feel free to adjust the Chocolatey configuration file for your own system.The Chocolatey Configuration file was generated by running the below in the
src\chocolatey\bin\debug
directory of the Chocolatey Licensed Extension after building the project.Initial Preparations:
C:\git
git clone https://gist.github.com/corbob/e1d021ccec9586a9e85061ee077b55dd.git
choco pack .\e1d021ccec9586a9e85061ee077b55dd\throw-message.nuspec --out C:\packages
copy .\e1d021ccec9586a9e85061ee077b55dd\chocolatey.config .
Testing the changes:
$env:CHOCO_SOURCE_LOCATION
and$env:CHOCO_PRO_SOURCE_LOCATION
to point toC:\git\choco
andC:\git\choco-licensed\
respectively. (These will not be set by default on the Developer VM as this is a different user account.)C:\git\chocolateygui-licensed
.\Get-ChocolateyGuiUpdatedDebugVersion.ps1
script.& 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe'
to start Visual Studio as this non-administrative user.$env:DebugChocolateyInstall = 'C:\git\choco-licensed\src\chocolatey\bin\debug'
& 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe'
to start Visual Studio as administrator with this environment variable set.throw-message
from thelocal
source in the Chocolatey GUI window.Operating Systems Testing
Windows 10
Change Types Made
Change Checklist
Related Issue