-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] -ErrorAction "SilentlyContinue" is ignored when the cmdlet throws a Terminating Error #2347
Comments
I'm having this same issue with Get-PnpFolder -Url $folderName -ErrorAction SilentlyContinue It throws a "File Not Found" error instead of continuing. |
I am having the same issue with Set-PnPListItemPermission cmdlet when the user in AAD is disabled (or recently enabled). It throws "The specified user cannot be found" |
Any ETA on a fix for this, or at least revert the change that broke it? I'm still chasing down this in my scripts, having to replace them with try/catch. |
wrapping the cmdltes in a try/catch block is the only workaround for now. Reverting the changes doesn't look like a good option, as the errorhandling is in general a lot better/consistent now with cmdltes throwing an exception when an error occurs (instead of only an error message without an exception) |
watch out for the try/catch workaround as you need to wrap every single cmdlet in the script (that you want to continue execution on error) with try/catch (or even nest try/catch in other try/catch, blaahhh). #Example: try{ try{ #In above example only get-goodcmd and then get-yetanothergoodcmd cmdlets will get executed. I've started using github actions with powershell just recently, but in my opinion github actions error handling for powershell should definitely respect overriding erroractions like "silentlycontinue" for cmdlets !! |
Yes, I wrap each one individually. I had to replace this, which used to work:
with:
I left the -ErrorAction there so when it is fixed at some point, I would know where to go back and remove the try/catch if I wanted to. Not a lot to be gained other then more succinct. |
Fix #2347 - issue with terminating error
Reporting an Issue or Missing Feature
When executing a Cmdlet with the ' -ErrorAction "SilentlyContinue" ' Parameter specified. The Cmdlet still throws a Terminating Error when a Terminatin Error occurs.
Expected behavior
It is expected that when the ' -ErrorAction "SilentlyContinue" ' Parameter is specified, that Terminating Errors are suppressed.
Actual behavior
Currently the Terminating Errors still come through, even if the ' -ErrorAction "SilentlyContinue" ' Parameter is specified.
Steps to reproduce behavior
The Script above will yield to the following Output:
Error Stacktrace:
What is the version of the Cmdlet module you are running?
1.11.74
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: