Skip to content

Feat/swift errorHandling - #321

Merged
nank1ro merged 1 commit into
mainfrom
feat/swift-errorHandling
Sep 17, 2026
Merged

nank1ro merged 1 commit into
mainfrom
feat/swift-errorHandling

Conversation

@nank1ro

@nank1ro nank1ro commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a new Swift argument, errorHandling, with 16 exercises (order 29) across all 12 locales (en, it, de, es, fr, hi, it, ja, ko, pl, pt, ru, zh).

Exercise mix: 7 type-1 (Run Code), 4 type-2 (Fill Empty Spaces), 3 type-3 (Choose Answer), 2 type-4 (Sort Items).

Concepts, in order:

  1. Declaring an Error type and handling a thrown error with do/catch (1, type 2)
  2. Marking a function throws and throwing a custom error (2, type 1)
  3. Catching a specific error case by name (3, type 2)
  4. Reading do/catch control flow (4, type 3)
  5. Errors with associated values (5, type 1)
  6. Ordering error declaration → throwing function → do/catch (6, type 4)
  7. guard ... else { throw } (7, type 1)
  8. try? and optional results (8, type 2)
  9. try? with ?? for a default value (9, type 1)
  10. When try! is appropriate (10, type 3)
  11. defer for cleanup on both normal return and throw (11, type 1)
  12. Reading nested error propagation (12, type 3)
  13. Rethrowing functions (rethrows) with throwing closures (13, type 1)
  14. Catching multiple distinct error cases separately (14, type 2)
  15. Ordering error declaration → function → loop with do/catch (15, type 4)
  16. Capstone validator combining the chapter's concepts (16, type 1)

Checks run

  • validator: pass
  • tester: pass — 7 type-1 exercises (2, 5, 7, 9, 11, 13, 16), 7/7 passed against codecompiler-8081
  • check_outputs_docker.sh: pass — 6 type-2/4 exercises (1, 3, 6, 8, 14, 15), 0 failed
  • check_locales.py: pass — 0 problems across 17 en files x 11 locales; all 12 locales have the 16 exercises plus _theory.md, and all 12 swift/data.json files declare errorHandling
  • curriculum.json and all _theory.md files regenerated

Known issues

None.

@nank1ro
nank1ro force-pushed the feat/swift-errorHandling branch from 05d99dd to 637b044 Compare September 17, 2026 05:42
@nank1ro
nank1ro merged commit 18d1adf into main Sep 17, 2026
4 checks passed
@nank1ro
nank1ro deleted the feat/swift-errorHandling branch September 17, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant