-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or requesterror-handlingrelated to error handlingrelated to error handlinggood first issueGood for newcomersGood for newcomers
Description
Is your feature request related to a problem?
Currently, if a user tries to validate a file that contains invalid YAML syntax, the application may crash or
produce a complex error message from the js-yaml library. We should handle this gracefully and provide a clear,
user-friendly error message.
Describe the solution you'd like
Tasks:
- In src/validate.js, locate the yaml.load() call within the validateYaml function.
- Wrap this call in a try...catch block.
- In the catch block, check if the error is a YAML parsing error.
- If it is, return an object in the same format as a validation failure, but with a custom error message,
e.g., { valid: false, errors: [{ message: 'The provided file is not a valid YAML document. Please check its
syntax.' }] }. - Update the tests in test/validate.test.js to include a new test case that asserts this user-friendly error
is returned when trying to validate a syntactically incorrect YAML file.
Describe alternatives you've considered
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesterror-handlingrelated to error handlingrelated to error handlinggood first issueGood for newcomersGood for newcomers