Exception: Climate::ExitException

Inherits:
CommandError show all
Defined in:
lib/climate/errors.rb

Overview

Command instances can raise this error to exit

Instance Attribute Summary collapse

Attributes inherited from CommandError

#command_class

Instance Method Summary collapse

Constructor Details

#initialize(msg, exit_code = 1) ⇒ ExitException

Returns a new instance of ExitException.



32
33
34
35
36
# File 'lib/climate/errors.rb', line 32

def initialize(msg, exit_code=1)
  @exit_code = exit_code
  @message = msg
  super(msg)
end

Instance Attribute Details

#exit_codeObject (readonly) Also known as: exitstatus

Returns the value of attribute exit_code.



28
29
30
# File 'lib/climate/errors.rb', line 28

def exit_code
  @exit_code
end

Instance Method Details

#has_message?Boolean

Ruby will helpfully change a nil message to be the name of the exception class, so we have to have a special predicate method to tell us whether message was nil or not

Returns:

  • (Boolean)


41
# File 'lib/climate/errors.rb', line 41

def has_message? ; !!@message ;  end