Introduce Errors and Exceptions handling
In the current version some errors are just written in the stderr, the validations and expected values for some of the functions and methods have no proper error and exception handling. Some examples are:
- in
moodle-tools.questions.converter.load_questions()
the validation errors are collected and then printed in stderr. - if file formats are not as expected, there is no such error handling mechanism
Therefore custom errors should be created in case of a very specific functionality or generic ones for simple functions.
-
Create the custom errors ParsingError
andValidationError
that subclassException
inutils.py
-
Create proper tests for file parsing and strict validation errors and enhance the existing ones -
Modify the code to handle errors and exceptions.