Custom Exceptions¶
Defines custom exceptions for the code validator application.
These custom exception classes allow for more specific error handling and provide clearer, more informative error messages throughout the application.
- exception code_validator.exceptions.CodeValidatorError¶
Bases:
ExceptionBase exception for all custom errors raised by this application.
- exception code_validator.exceptions.RuleParsingError(message: str, rule_id: int | str | None = None)¶
Bases:
CodeValidatorErrorRaised when a validation rule in the JSON file is malformed or invalid.
This error indicates a problem with the configuration of a rule, not with the code being validated.
- rule_id¶
The ID of the rule that caused the error, if available.
- Type:
int | str | None
- exception code_validator.exceptions.ValidationFailedError¶
Bases:
CodeValidatorErrorRaised to signal that the source code did not pass validation.
Note
Currently, this exception is defined but not actively raised, as the application handles validation failure via exit codes in the CLI. It is kept for potential future use in a library context.