-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Actual Behavior
Description:
The function parseContent() in utils/parse.js (or similar helper file) doesn’t check for empty or undefined input before processing. This may cause unexpected errors if someone calls the function without arguments
The function parseContent() in utils/parse.js (or a similar helper file) doesn’t check for empty or undefined input before processing.
This can cause unexpected runtime errors when the function is called without valid content.
Example:
parseContent(); // Throws undefined error
Expected Behavior
Expected Behavior
The function should validate input and throw a clear, descriptive error when content is missing.
Expected output:
Error: Input content cannot be empty.
Suggested Fix:
Add a simple guard clause:
if (!content) {
throw new Error("Input content cannot be empty.");
}
On what browser(s) are you seeing the problem?
No response
Code of Conduct
- By submitting this issue, I agree to follow Codecademy Doc's Code of Conduct.
For Maintainers
- Labels added
- Issue is assigned