Method: Beaker::Subcommands::SubcommandUtil.error_with

Defined in:
lib/beaker/subcommands/subcommand_util.rb

.error_with(msg, options = {}) ⇒ Object

Print a message to the console and exit with specified exit code, defaults to 1  @param [String] msg the message to output

Parameters:

  • options (Hash<Object>) (defaults to: {})

    to specify exit code or output stack trace



51
52
53
54
55
56
# File 'lib/beaker/subcommands/subcommand_util.rb', line 51

def self.error_with(msg, options={})
  puts msg
  puts options[:stack_trace] if options[:stack_trace]
  exit_code = options[:exit_code] ? options[:exit_code] : 1
  exit(exit_code)
end