Exception: Quickl::Exit

Inherits:
Error show all
Defined in:
lib/quickl/errors.rb

Overview

This error can be raised to exit command execution with a message and exit code.

Default exit code:

0

Default reaction:

Prints the error message (on $stdout if exit code is 0, on $stderr 
otherwise) then invoke Kernel.exit with the exit code.

Examples:

# Non-failure exit, for --version, --help, --copyright and the 
# like
raise Quickl::Exit, "a friendly message"

# Failure exit, because something failed
raise Quickl::Exit.new(-1), "Something was wrong!"

Instance Attribute Summary

Attributes inherited from Error

#command, #exit_code

Instance Method Summary collapse

Methods inherited from Error

#do_kernel_exit, #error_io, #exit?

Constructor Details

#initialize(*args) ⇒ Exit

Returns a new instance of Exit.



72
73
74
# File 'lib/quickl/errors.rb', line 72

def initialize(*args)
  super(*(args + [ 0 ]))
end

Instance Method Details

#react!Object



76
77
78
# File 'lib/quickl/errors.rb', line 76

def react!
  do_kernel_exit
end