improve(core): enhance code quality with better error handling and docs..#10893
Open
dollaransh17 wants to merge 1 commit intoNativeScript:mainfrom
Open
improve(core): enhance code quality with better error handling and docs..#10893dollaransh17 wants to merge 1 commit intoNativeScript:mainfrom
dollaransh17 wants to merge 1 commit intoNativeScript:mainfrom
Conversation
…cumentation - Add comprehensive JSDoc documentation for helper functions in application/helpers-common.ts - Improve error handling in Android native app initialization with try-catch block - Resolve TODO comment about custom application type handling - Enhance timeConverter function with input validation and better error messages - Improve cubic-bezier animation error message with detailed format expectations - Add proper return type annotations for background state functions - Better developer warnings when reflection fails during app initialization These improvements enhance code maintainability, provide better developer experience, and make error messages more actionable for debugging.
| export function timeConverter(value: string): number { | ||
| let result = parseFloat(value); | ||
| if (!value || typeof value !== 'string') { | ||
| throw new Error(`Invalid time value: '${value}'. Expected a string with time value.`); |
Contributor
There was a problem hiding this comment.
Suggested change
| throw new Error(`Invalid time value: '${value}'. Expected a string with time value.`); | |
| console.warn(`Invalid time value: '${value}'. Expected a string with time value.`); |
we avoid unnecessary throw in core.
|
|
||
| const numericValue = parseFloat(value); | ||
| if (isNaN(numericValue)) { | ||
| throw new Error(`Invalid time value: '${value}'. Expected a numeric value with optional 's' or 'ms' unit.`); |
Contributor
There was a problem hiding this comment.
Suggested change
| throw new Error(`Invalid time value: '${value}'. Expected a numeric value with optional 's' or 'ms' unit.`); | |
| console.warn(`Invalid time value: '${value}'. Expected a numeric value with optional 's' or 'ms' unit.`); |
Suggested change
| throw new Error(`Invalid time value: '${value}'. Expected a numeric value with optional 's' or 'ms' unit.`); | |
| console.warn(`Invalid time value: '${value}'. Expected a string with time value.`); |
we avoid unnecessary throw in core.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These improvements enhance code maintainability, provide better developer experience, and make error messages more actionable for debugging.
PR Checklist
What is the current behavior?
What is the new behavior?
Fixes/Implements/Closes #[Issue Number].