Skip to content

refactor: rename CLI to Cli and add proper error handling#24

Merged
ronaldtse merged 7 commits intomainfrom
rt-clean-methods
Apr 3, 2026
Merged

refactor: rename CLI to Cli and add proper error handling#24
ronaldtse merged 7 commits intomainfrom
rt-clean-methods

Conversation

@ronaldtse
Copy link
Copy Markdown
Contributor

@ronaldtse ronaldtse commented Apr 3, 2026

Summary

  • Rename Unitsdb::CLI to Unitsdb::Cli (proper Ruby naming conventions)
  • Add new descriptive error classes for CLI errors:
    • CLIRuntimeError (base class)
    • InvalidParameterError - for invalid CLI arguments
    • FileNotFoundError - for missing files/directories
    • ValidationError - for validation failures
    • InvalidFormatError - for invalid format options
  • Replace all exit(1) calls with proper exception raising
  • Add --trace Thor option for showing full backtraces during debugging
  • Add error handling at each Thor command level (CLI, ValidateCommand, UcumCommand, QudtCommand, ModifyCommand) to display clean error messages

Test plan

  • All 808 tests pass
  • CLI errors display cleanly without backtraces
  • --trace flag shows full backtrace when needed

- Rename Unitsdb::CLI to Unitsdb::Cli (proper Ruby naming)
- Add new error classes: CLIRuntimeError, InvalidParameterError,
  FileNotFoundError, ValidationError, InvalidFormatError
- Replace all exit(1) calls with proper exception raising
- Add --trace option as Thor class_option for debugging
- Add error handling at each Thor command level to display
  clean error messages without backtraces
- Update specs to expect new error classes instead of SystemExit
@ronaldtse ronaldtse changed the title Clean unused methods refactor: rename CLI to Cli and add proper error handling Apr 3, 2026
@ronaldtse ronaldtse merged commit 315d30e into main Apr 3, 2026
15 of 18 checks passed
@ronaldtse ronaldtse deleted the rt-clean-methods branch April 3, 2026 22:53
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