-
Notifications
You must be signed in to change notification settings - Fork 12
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
Lack of CmdletBinding prevents ErrorAction from propagating #53
Labels
bug
Something isn't working
Comments
Thanks for the bug report! We should indeed have I'll add those, and see if I can use your repro instructions as a unit test. |
lupino3
added a commit
that referenced
this issue
May 10, 2023
This will allow, among other things, propagation of the ErrorAction parameter, and correctly inhibit output when needed. This behavior is tested in a new test for Get-FeatureFlagConfigFromFile. Fixes Lack of CmdletBinding prevents ErrorAction from propagating #53
lupino3
added a commit
that referenced
this issue
May 11, 2023
This will allow, among other things, propagation of the ErrorAction parameter, and correctly inhibit output when needed. This behavior is tested in a new test for Get-FeatureFlagConfigFromFile. Fixes Lack of CmdletBinding prevents ErrorAction from propagating #53
Should be fixed. Thanks for the bug report! I'll try to do a release today. |
The fix is released in version 2.1.1: https://github.com/microsoft/PowerShell-FeatureFlags/releases/tag/2.1.1. |
Thank you very much! |
Verified working for me. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that not having
[CmdletBinding()]
for the functions is preventing an explicitly passed-ErrorAction
from propagating to child calls. For example, if I callGet-FeatureFlagConfigFromFile -jsonConfigPath $f -ErrorAction SilentlyContinue
where$f
is a path that does not exist, you will get a halting error; however, if I add[CmdletBinding()]
to that function, the halting error moves to the child callConfirm-FeatureFlagConfig
- and if I add[CmdletBinding()]
to that function, then I get back$null
likeGet-FeatureFlagConfigFromFile
code is written.To reproduce:
Call
$c = Get-FeatureFlagConfigFromFile -jsonConfigPath $f
where$f
is a path that does not existthen
Call
$c2 = Get-FeatureFlagConfigFromFile -jsonConfigPath $f -ErrorAction SilentlyContinue
where$f
is a path that does not exist$c2 should be returned without outputting an error to the console, and be
$null
I thought this was working in earlier tests, but trying it now,
-ErrorAction
is not being passed on.I'm using version 2.1.0 of FeatureFlags in Powershell 5 with the following
$PSVersionTable
The text was updated successfully, but these errors were encountered: