Skip to content

Raise categorized exceptions from API#38

Merged
marktsuchida merged 4 commits into
mainfrom
api-exceptions
Jan 5, 2026
Merged

Raise categorized exceptions from API#38
marktsuchida merged 4 commits into
mainfrom
api-exceptions

Conversation

@marktsuchida

@marktsuchida marktsuchida commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

Previously we just let whatever exception that gets raised propagate out of our API.

Introduce a categorized exception hierarchy and wrap errors so that the caller can distinguish between kinds of error (incorrect input vs no such JDK vs download/install failure).

Unanticipated exceptions (i.e., bugs) will leak out, as with any Python code, of course.

Change the CLI to omit the stack trace and just print the error message when a known error happens. Also introduce specific exit codes for the error categories.

This is a start; not all common error cases are necessarily covered.

Also omit traceback from CLI on known error.

(Assisted by Claude Code; any errors are mine.)
Try best to cover all cases where a non-bug exception can be raised.

(Assisted by Claude Code; any errors are mine.)
The distinction is not always possible (if concurrent fetch fails, we
don't know which), and not very useful to the calling code. Keep it
simple at least for now.

(Assisted by Claude Code; any errors are mine.)
@marktsuchida marktsuchida merged commit 989ee27 into main Jan 5, 2026
12 checks passed
@marktsuchida marktsuchida deleted the api-exceptions branch January 5, 2026 23:37
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.

Use concise messages, not exceptions with stacktraces, for known errors

1 participant