Module: SnippetCli::WizardHelpers::ErrorHandler
- Included in:
- Commands::Check, Commands::Conflict, Commands::Vars, NewWorkflow
- Defined in:
- lib/snippet_cli/wizard_helpers/error_handler.rb
Overview
Wraps a command body with standard error handling. Rescues WizardInterrupted (Ctrl+C) universally. Rescues typed error_classes passed by the caller, displaying their message via UI.error and exiting 1.
Instance Method Summary collapse
Instance Method Details
#handle_errors(*error_classes) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/snippet_cli/wizard_helpers/error_handler.rb', line 9 def handle_errors(*error_classes) yield rescue *error_classes => e UI.error(e.) exit 1 rescue WizardInterrupted puts UI.error('Interrupted, exiting snippet_cli.') end |