Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce use of app-specific exceptions #26

Merged
merged 2 commits into from
Nov 13, 2024
Merged

Conversation

mrchrisadams
Copy link
Member

This pull request includes several changes to improve error handling and logging in the carbon_txt CLI application. The most important changes involve replacing sys.exit calls with typer.Exit for better integration with Typer, enhancing exception handling, and adding new tests for missing files.

Error Handling Improvements:

  • Replaced sys.exit calls with typer.Exit in various functions for better integration with Typer. [1] [2] [3] [4] [5] [6]
  • Enhanced exception handling in validate_file to catch specific exceptions (FileNotFoundError, UnreachableCarbonTxtFile, NotParseableTOML) and log appropriate messages.

Logging Enhancements:

  • Added logging statements in validate_file to log the discovery and parsing of carbon.txt files.

Exception Handling Enhancements:

  • Introduced new exceptions (UnreachableCarbonTxtFile, NotParseableTOML) in exceptions.py to handle specific error cases.
  • Updated finders.py and parsers_toml.py to use the new exceptions for better error reporting. [1] [2] [3] [4]

Testing Improvements:

  • Added a new test in test_cli.py to check the behavior when a carbon.txt file is missing.

@mrchrisadams mrchrisadams merged commit 4a7a7eb into main Nov 13, 2024
6 checks passed
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.

1 participant