Skip to content
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

Plugin Prop Validation & Improvements #201

Merged
merged 4 commits into from
Sep 27, 2023
Merged

Plugin Prop Validation & Improvements #201

merged 4 commits into from
Sep 27, 2023

Conversation

rgomezp
Copy link
Contributor

@rgomezp rgomezp commented Sep 26, 2023

One line summary

Add plugin props validation for better error handling and clearer error messages.

Description

This PR addresses issues related to plugin props in our codebase. The motivation behind these changes is to improve error handling and provide clearer error messages for developers working with our code.

Previously, the property "mode" was required in the plugin props, but there was no validation in place to check if it was provided. This led to runtime errors in Node.js when attempting to access the optional prop "smallIcons" when the props object was undefined. This situation was confusing for developers who were setting up the plugin array for the first time without specifying a props object. To mitigate this, we have added validation to ensure that the "mode" property is always provided, resulting in a much clearer error message when it's missing.

Additionally, we have extended the validation to cover cases where users provide props of the wrong type or provide props that do not match the model's requirements. This enhancement will help prevent unexpected issues and make debugging easier.

Lastly, we have updated the type definition to correctly indicate that "devTeam" and "iPhoneDeploymentTarget" are optional properties, aligning our code with their actual usage.

These changes collectively improve the robustness of our codebase and enhance the developer experience by providing informative error messages and more accurate type definitions.

Motivation: the property "mode" is required. Currently, because we don't check for this, nodejs is throwing a runtime error when trying to access smallIcons (optional prop) when the props object is undefined.

This is confusing for folks who first set up and try running without setting a props object to the plugin array.

Clear error message will be much more helpful.
Motivation: we can provide better error messages by throwing when the user provides props of the wrong type or not in the model
Motivation: devTeam & iPhoneDeploymentTarget are optional.
Base automatically changed from small-icon-color to main September 26, 2023 23:04
Update version in package.json
@rgomezp rgomezp merged commit cf59ea9 into main Sep 27, 2023
1 check passed
@rgomezp rgomezp deleted the check-plugin-props branch September 27, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants