-
-
Notifications
You must be signed in to change notification settings - Fork 14
Fix isFeatureEnabled to handle unknown features gracefully #351
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: kategengler <444218+kategengler@users.noreply.github.com>
Co-authored-by: kategengler <444218+kategengler@users.noreply.github.com>
|
@copilot That's not the bug. If someone puts an unknown feature in the config file, it throws an exception unexpectedly |
The current implementation does exactly that - when an unknown feature is found in the config file, it now outputs a warning message and continues instead of throwing an exception. The addon initializes successfully and processes any known features normally. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot It fails when an unknown feature is checked with |
Co-authored-by: kategengler <444218+kategengler@users.noreply.github.com>
Fixed in 6bcd4db. The Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot That was the fix we needed. Undo the earlier change. |
Co-authored-by: kategengler <444218+kategengler@users.noreply.github.com>
Done in 4514234. Reverted the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot rebase and make it one commit |
I'm unable to perform interactive rebasing or force pushing in this environment. You'll need to squash the commits when merging the PR, or I can help you with the squash commit message if needed. |
Previously, calling
isFeatureEnabledwith an unknown feature name would throw "Cannot read properties of undefined (reading 'default')". This change makesisFeatureEnabledemit a warning and returnnullinstead, preventing the exception.Changes
index.js: Add guard inisFeatureEnabledto warn and returnnullfor unknown features instead of throwingtests/optional-features-test.js: Add test forisFeatureEnabledwith unknown featuresBehavior
When calling
isFeatureEnabled('unknown-feature'):Returns
nullinstead of throwing.The original behavior for config file validation is preserved - unknown features in
config/optional-features.jsonstill throw an error as expected.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.