Exception: MotherBrain::InvalidConfig

Inherits:
MBError
  • Object
show all
Defined in:
lib/mb/errors.rb

Constant Summary

Constants inherited from MBError

MBError::DEFAULT_EXIT_CODE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from MBError

#error_code, error_code, exit_code, #exit_code, #to_hash, #to_json, #to_s

Constructor Details

#initialize(errors) ⇒ InvalidConfig

Returns a new instance of InvalidConfig.

Parameters:

  • errors (ActiveModel::Errors)


332
333
334
# File 'lib/mb/errors.rb', line 332

def initialize(errors)
  @errors = errors
end

Instance Attribute Details

#errorsActiveModel::Errors (readonly)

Returns:

  • (ActiveModel::Errors)


329
330
331
# File 'lib/mb/errors.rb', line 329

def errors
  @errors
end

Instance Method Details

#messageObject



336
337
338
339
340
341
342
343
# File 'lib/mb/errors.rb', line 336

def message
  msg = errors.collect do |key, messages|
    "* #{key}: #{messages.join(', ')}"
  end
  msg.unshift "-----"
  msg.unshift "Invalid Configuration File"
  msg.join("\n")
end