Search⌘ K
AI Features

Displaying Actual Errors

Explore how to implement error handling for validation in auto-validating forms using custom error classes, try/catch blocks, and mapping inputs to validation rules. Understand how to test validation logic effectively to ensure accurate user feedback.

We'll cover the following...

We now have a basic form, some JavaScript to execute validation on each input at the correct time, a way to distinguish which field is which, and a set of validation rules to apply to each one. Let’s put the pieces together now!

Changelist

  • Create a unique error class
    • This lets us do things only with expected errors that arise from validation by checking instanceof.
  • Introduce a try/catch for validation.
    • The catch
...