Module: Equilibrium::Mixins::ErrorHandling

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.message  # Convert for test compatibility
rescue SchemaValidator::ValidationError => e
  error_and_exit(e.message)
rescue JSON::ParserError => e
  error_and_exit("Invalid JSON input: #{e.message}")
rescue => e
  error_and_exit(e.message)
end