runtimeverification / runtimeverification/kontrol
Extend the use of custom errors and exit codes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 122
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Related: https://github.com/runtimeverification/kontrol/pull/279
As @tothtamas28 suggested, we can start building a library of custom exceptions, and, for CLI usage, we can then catch them, print some error message, then exit with the corresponding exit code. We can also have a catch-all case for unhandled exceptions, for which we can do some extra logging and perhaps ask the user to submit a bug report.
This would also help us capture errors more accurately. For example, we should throw an error instead of exiting with code 1 in the following case (right now, if the caller wants to handle that exception (e.g. by translating to an error message on the output), they will be forced to catch SystemExit):
def build(self) -> None:
try:
run_process(['forge', 'build', '--root', str(self._root)], logger=_LOGGER)
except FileNotFoundError:
print("Error: 'forge' command not found. Please ensure that 'forge' is installed and added to your PATH.")
sys.exit(1)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the related pull request #279 and the build method in src/kontrol/foundry.py around the linked FileNotFoundError case. Trace the CLI entry points that currently handle failures and exit codes. Done means the agreed custom-error and CLI handling scope is implemented with corresponding exit behavior and coverage for the shown failure and unhandled exceptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100