Module: Shellissimo

Defined in:
lib/shellissimo.rb,
lib/shellissimo/dsl.rb,
lib/shellissimo/help.rb,
lib/shellissimo/shell.rb,
lib/shellissimo/command.rb,
lib/shellissimo/version.rb,
lib/shellissimo/command_name.rb,
lib/shellissimo/input_parser.rb,
lib/shellissimo/command_param.rb,
lib/shellissimo/error_handling.rb,
lib/shellissimo/commands_collection.rb,
lib/shellissimo/dsl/command_builder.rb,
lib/shellissimo/command_param_validator.rb,
lib/shellissimo/dsl/command_param_builder.rb

Defined Under Namespace

Modules: DSL Classes: Command, CommandName, CommandNotFoundError, CommandParam, CommandParamValidator, CommandsCollection, Help, InputParser, Shell

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.with_error_handlingObject

Wraps code in catch-all block



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/shellissimo/error_handling.rb', line 6

def self.with_error_handling
  begin
    yield
  rescue SystemExit
    exit 0
  rescue Exception => e
    $stderr.puts "An error occured: #{e.message}"
    if ENV['DEBUG']
      $stderr.puts e.class.name
      $stderr.puts e.backtrace
    end
  end
end