Sha256: ac9d3cc8812a97f808abbc676928654cf661d9be5bc85c484cb6ff9923db61de

Contents?: true

Size: 689 Bytes

Versions: 2

Compression:

Stored size: 689 Bytes

Contents

module AASM

  class UnknownStateMachineError < RuntimeError; end

  class InvalidTransition < RuntimeError
    attr_reader :object, :event_name, :originating_state, :failures

    def initialize(object, event_name, state_machine_name, failures = [])
      @object, @event_name, @originating_state, @failures = object, event_name, object.aasm(state_machine_name).current_state, failures
      super("Event '#{event_name}' cannot transition from '#{originating_state}'.#{reasoning}")
    end

    def reasoning
      " Failed callback(s): #{failures}." unless failures.empty?
    end
  end

  class UndefinedState < RuntimeError; end
  class NoDirectAssignmentError < RuntimeError; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aasm-5.0.1 lib/aasm/errors.rb
aasm-5.0.0 lib/aasm/errors.rb