Exception: Smith::PersistenceSchemaMismatch

Inherits:
Error
  • Object
show all
Defined in:
lib/smith/errors.rb

Overview

Raised when restoring a persisted payload whose schema_version does not match the workflow’s current persistence_schema_version AND no migration block is registered to bridge the gap. Hosts fix this by adding ‘migrate_from(stored) do |payload| … end` to the workflow class, or by bumping persistence_schema_version to match the stored version. Downgrades (stored > current) always raise; Smith has no rollback semantics.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow:, stored:, current:) ⇒ PersistenceSchemaMismatch

Returns a new instance of PersistenceSchemaMismatch.



171
172
173
174
175
176
# File 'lib/smith/errors.rb', line 171

def initialize(workflow:, stored:, current:)
  @workflow = workflow
  @stored = stored
  @current = current
  super(format_message(workflow, stored, current))
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



169
170
171
# File 'lib/smith/errors.rb', line 169

def current
  @current
end

#storedObject (readonly)

Returns the value of attribute stored.



169
170
171
# File 'lib/smith/errors.rb', line 169

def stored
  @stored
end

#workflowObject (readonly)

Returns the value of attribute workflow.



169
170
171
# File 'lib/smith/errors.rb', line 169

def workflow
  @workflow
end