Exception: Cl::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cl/errors.rb

Direct Known Subclasses

UnknownCmd, UnknownOption

Constant Summary collapse

MSGS =
{
  unknown_cmd:    'Unknown command: %s',
  unknown_option: 'Unknown option: %s',
  unknown_arg:    'Unknown argument value: %s (known: %s)',
  missing_args:   'Missing arguments (given: %s, required: %s)',
  too_many_args:  'Too many arguments: %s (given: %s, allowed: %s)',
  wrong_type:     'Wrong argument type (given: %s, expected: %s)',
  out_of_range:   'Out of range: %s',
  invalid_format: 'Invalid format: %s',
  unknown_values: 'Unknown value: %s',
  required_opt:   'Missing required option: %s',
  required_opts:  'Missing required options: %s',
  requires_opt:   'Missing option: %s',
  requires_opts:  'Missing options: %s',
}

Instance Method Summary collapse

Constructor Details

#initialize(msg, *args) ⇒ Error

Returns a new instance of Error.



21
22
23
# File 'lib/cl/errors.rb', line 21

def initialize(msg, *args)
  super(MSGS[msg] ? MSGS[msg] % args : msg)
end