Class: ThreeScaleToolbox::CLI::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/3scale_toolbox/cli/error_handler.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.error_watchdogObject



4
5
6
# File 'lib/3scale_toolbox/cli/error_handler.rb', line 4

def self.error_watchdog
  new.error_watchdog { yield }
end

Instance Method Details

#error_watchdogObject

Catches errors and prints nice diagnostic messages



9
10
11
12
13
14
15
16
17
# File 'lib/3scale_toolbox/cli/error_handler.rb', line 9

def error_watchdog
  # Run
  yield
rescue StandardError, ScriptError => e
  handle_error e
  e
else
  nil
end