Exception: Cosmos::ConfigParser::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cosmos/config/config_parser.rb

Overview

Error which gets raised by ConfigParser in #verify_num_parameters. This is also the error that classes using ConfigParser should raise when they encounter a configuration error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_parser, message = "Configuration Error", usage = "", url = "") ⇒ Error

Create an Error with the specified Config data

Parameters:

  • config_parser (ConfigParser)

    Instance of ConfigParser so Error has access to the ConfigParser attributes

  • message (String) (defaults to: "Configuration Error")

    The error message which gets passed to the StandardError constructor

  • usage (String) (defaults to: "")

    The usage string representing how this keyword should be formatted.

  • url (String) (defaults to: "")

    URL which should point to usage information. By default this gets constructed to point to the generic configuration Guide on the COSMOS Wiki.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/cosmos/config/config_parser.rb', line 113

def initialize(config_parser, message = "Configuration Error", usage = "", url = "")
  if Error == message
    super(message.message)
  elsif Exception == message
    super("#{message.class}:#{message.message}")
  else
    super(message)
  end
  @keyword = config_parser.keyword
  @parameters = config_parser.parameters
  @filename = config_parser.filename
  @line = config_parser.line
  @line_number = config_parser.line_number
  @usage = usage
  @url = url
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



92
93
94
# File 'lib/cosmos/config/config_parser.rb', line 92

def filename
  @filename
end

#keywordObject (readonly)

Returns the value of attribute keyword.



92
93
94
# File 'lib/cosmos/config/config_parser.rb', line 92

def keyword
  @keyword
end

#lineObject (readonly)

Returns the value of attribute line.



92
93
94
# File 'lib/cosmos/config/config_parser.rb', line 92

def line
  @line
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



92
93
94
# File 'lib/cosmos/config/config_parser.rb', line 92

def line_number
  @line_number
end

#parametersObject (readonly)

Returns the value of attribute parameters.



92
93
94
# File 'lib/cosmos/config/config_parser.rb', line 92

def parameters
  @parameters
end

#urlString (readonly)

Returns URL which points to usage documentation on the COSMOS Wiki.

Returns:

  • (String)

    URL which points to usage documentation on the COSMOS Wiki.



100
101
102
# File 'lib/cosmos/config/config_parser.rb', line 100

def url
  @url
end

#usageString (readonly)

Returns The usage string representing how this keyword should be formatted.

Returns:

  • (String)

    The usage string representing how this keyword should be formatted.



96
97
98
# File 'lib/cosmos/config/config_parser.rb', line 96

def usage
  @usage
end