Section
4.2.5
Top Level
Sub Level
General
When your code performs validation, there are a variety of possible actions in response to a validation failure. They range from simple error handling to complete system shutdown. Many applications respond to all errors in the same way. This severely limits the type of errors likely to be detected and the appropriateness of the response.
Django
Validation errors usually raise a ValidationError
exception, which is caught by the form system and displayed as an error to the user. Your custom forms or form fields can raise any error and handle it as appropriate.