Exception: Machinery::Errors::SystemDescriptionIncompatible

Inherits:
SystemDescriptionError show all
Defined in:
lib/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, format_version) ⇒ SystemDescriptionIncompatible

Returns a new instance of SystemDescriptionIncompatible.



48
49
50
51
# File 'lib/exceptions.rb', line 48

def initialize(name, format_version)
  @name = name
  @format_version = format_version
end

Instance Attribute Details

#format_versionObject (readonly)

Returns the value of attribute format_version.



46
47
48
# File 'lib/exceptions.rb', line 46

def format_version
  @format_version
end

#nameObject (readonly)

Returns the value of attribute name.



46
47
48
# File 'lib/exceptions.rb', line 46

def name
  @name
end

Instance Method Details

#to_sObject



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/exceptions.rb', line 53

def to_s
  if !@format_version
    "#{@name}: incompatible format version. Can not be upgraded."
  elsif @format_version < SystemDescription::CURRENT_FORMAT_VERSION
    "#{@name}: format version #{@format_version}, needs to be upgraded. "\
    "Try '#{Ui::Hint.program_name} upgrade-format #{name}'"\
    " to upgrade it to the current version."
  else
    "#{@name}: format version #{@format_version}. " \
      "Please upgrade Machinery to the latest version."
  end
end