Collecting Several Validation Errors

Independent input errors can be reported together when each check has sufficient valid data to run.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace two different fields
  2. Keep the association

Trace two different fields

A form can reject a negative quantity and require a missing label in the same response. A numeric comparison should still wait until its own text field was parsed. Composed validators make such prerequisite relationships visible.

Keep the association

Attach each reason to the corresponding field rather than returning a flat sentence a caller must parse. A decision result with reasons provides a stable interface for display and tests.[1]

References

  1. Python Software Foundation, Python Tutorial: Errors and Exceptions ↩