Skip to main content

Practice ยท 2 of 3

Milestone 2: Service and Errors

Build a typed validation boundary: ValidationError(TaskError) and service functions add_task(repo, title: str) -> int (strip title; empty/whitespace or non-str raises ValidationError; then delegates to repo.add) and complete_task(repo, task_id: int) -> bool (non-int raises ValidationError; missing id raises NotFoundError(TaskError)). Annotations must be readable via typing.get_type_hints.

Difficulty: advanced

Back to lesson: Practice: Capstone Milestones