Skip to content

CLI: Replace ad-hoc failwith with structured Cli_error exception#93

Draft
febyeji wants to merge 1 commit intomainfrom
feature/cli-error-handling
Draft

CLI: Replace ad-hoc failwith with structured Cli_error exception#93
febyeji wants to merge 1 commit intomainfrom
feature/cli-error-handling

Conversation

@febyeji
Copy link
Collaborator

@febyeji febyeji commented Mar 21, 2026

Context

CLI exception handling was ad-hoc — all errors used bare failwith, so runner.ml couldn't distinguish parse errors from model crashes. This adds a structured Cli_error exception with origin tags.

Ordering

Design question

Parse errors and convert errors both map to SetupError in test_result. The [origin] tag ([parser] vs [converter]) distinguishes them in output, but test_result has a single SetupError variant for both. Should these be separate variants (e.g. SetupError vs ConvertError)?

cc @tperami

@febyeji febyeji force-pushed the feature/cli-error-handling branch from 84c6b98 to 7410257 Compare March 21, 2026 00:36
@tperami
Copy link
Collaborator

tperami commented Mar 21, 2026

I think it's fine of both of those are setup errors

@febyeji febyeji force-pushed the feature/cli-error-handling branch from 7410257 to b8f71bc Compare March 22, 2026 00:59
- Add Error.ml with Cli_error exception, origin tags, and raise helpers
- Replace bare failwith across all CLI modules
- Restructure runner with nested try-with (setup errors vs model crashes)
- Rename ParseError to SetupError in test_result
@febyeji febyeji force-pushed the feature/cli-error-handling branch from b8f71bc to 35dfbd2 Compare March 23, 2026 15:06
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.

2 participants