🛡️ Project: Input Validator

📚 Lesson 6: Error Handling ⏱ 25-30 min 📊 Intermediate
🎯 Objective

Build a form validation system with custom exception classes for different validation errors. Learn to create meaningful error messages and handle multiple validation scenarios.

Requirements

  1. Create custom exception classes: ValidationException, EmptyFieldException, InvalidFormatException, LengthException, RangeException
  2. Build a FormValidator class that validates multiple fields
  3. Validate: email format, password strength, username length, age range, phone number format
  4. Collect all validation errors before throwing
  5. Display clear error messages for each failed validation
  6. Use try/catch to handle validation in the main program

Expected Output

Terminal
╔══════════════════════════════════╗
║       FORM VALIDATOR SYSTEM       ║
╚══════════════════════════════════╝

📝 Validating form data...

✅ Email: user@example.com - Valid
✅ Username: john_doe - Valid
❌ Password: weak - Too short (min 8 characters)
❌ Age: 15 - Must be at least 18
✅ Phone: (555) 123-4567 - Valid

📊 Validation Results: 3/5 fields passed
❌ Errors found:
  • Password: Password must be at least 8 characters
  • Age: Age must be 18 or older