microsoft / winget-command-not-found

WinGet Command Not Found is a PowerShell 7 module to help you install missing packages. With this module, you will be recommended relevant WinGet packages whenever an unrecognized command is entered.
MIT License
19 stars 0 forks source link

Handle unhandled exceptions in WarmUp() #10

Closed carlos-zamora closed 3 weeks ago

carlos-zamora commented 3 weeks ago

WarmUp() asynchronously calls Find-WinGetPackage when the module is imported to pre-load the WinGet database so that future calls are faster.

For #8, a PipelineStoppedException would occur when the user exits or ^C during that async call. For #9, a CmdletInvocationException would occur from Microsoft.WinGet.Client failing to create some WinGet objects.

We're normally able to handle an exception here, but we don't actually have any error handling in WarmUp(). This just adds a catch there.

Though we don't actually do anything with the error there, here's what's expected from the situations encountered:

Closes #7 Closes #8 Closes #9