Skip to content

Add [--if-error] block to Option.parse for clean error reporting.#94

Merged
floitsch merged 1 commit intomainfrom
floitsch/ui-abort
Apr 4, 2026
Merged

Add [--if-error] block to Option.parse for clean error reporting.#94
floitsch merged 1 commit intomainfrom
floitsch/ui-abort

Conversation

@floitsch
Copy link
Copy Markdown
Member

@floitsch floitsch commented Apr 4, 2026

Option.parse methods previously used throw for validation errors, which propagated uncaught through the parser. Now they take a required [--if-error] block. The parser provides a block that calls fatal (which shows help and calls ui.abort), giving clean error output.

Also adds InFile.check [--if-error] and InFile.check --ui/Ui overloads for flexible error handling on file existence checks.

BREAKING: Option.parse now requires an --if-error block argument.

Option.parse methods previously used `throw` for validation errors,
which propagated uncaught through the parser. Now they take a required
`[--if-error]` block. The parser provides a block that calls `fatal`
(which shows help and calls `ui.abort`), giving clean error output.

Also adds `InFile.check [--if-error]` and `InFile.check --ui/Ui`
overloads for flexible error handling on file existence checks.

BREAKING: Option.parse now requires an `--if-error` block argument.
@floitsch floitsch requested a review from kasperl April 4, 2026 14:47
@floitsch
Copy link
Copy Markdown
Member Author

floitsch commented Apr 4, 2026

TBR.

@floitsch floitsch merged commit d299878 into main Apr 4, 2026
7 checks passed
@floitsch floitsch deleted the floitsch/ui-abort branch April 4, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant