Module: Equilibrium::Mixins::ErrorHandling
- Included in:
- Commands::ActualCommand, Commands::AnalyzeCommand, Commands::CatalogCommand, Commands::ExpectedCommand, Commands::UncatalogCommand
- Defined in:
- lib/equilibrium/mixins/error_handling.rb
Overview
Module for consistent error handling across all commands
Instance Method Summary collapse
Instance Method Details
#with_error_handling(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/equilibrium/mixins/error_handling.rb', line 11 def with_error_handling(&block) block.call rescue Thor::Error raise # Let Thor::Error bubble up for validation errors rescue RegistryClient::Error => e raise StandardError, e. # Convert for test compatibility rescue SchemaValidator::ValidationError => e error_and_exit(e.) rescue JSON::ParserError => e error_and_exit("Invalid JSON input: #{e.message}") rescue => e error_and_exit(e.) end |