apple / apple/swift-argument-parser

Do not use throw on happy path

Open
#274 8 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 14h
Merged PRs (30d)
15

Description

Currently, it seems that at ParsableArgumentsValidation.swift:140, there is a `throw ValidationResult.success` that triggers on the regular happy path. This makes it very annoying to debug your code if you use a Swift error breakpoint in Xcode, as it will trigger several times before getting to the actual code that needs debugging.

I think most Swift code generally avoids throwing for program flow, and it would be nice if this code could also be changed to avoid that, to make debugging easier.

Contributor guide

Open the contributing guide

Research direction

Start in ParsableArgumentsValidation.swift at line 140 and trace how the successful validation result is propagated through the surrounding flow. Determine how to avoid throwing on the happy path while preserving validation behavior, then verify that Swift error breakpoints no longer stop on successful validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.