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.



43
44
45
46
# File 'lib/exceptions.rb', line 43

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.



41
42
43
# File 'lib/exceptions.rb', line 41

def format_version
  @format_version
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/exceptions.rb', line 41

def name
  @name
end

Instance Method Details

#to_sObject



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/exceptions.rb', line 48

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 '#{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