Sha256: 8d3cc9b88e01a45b2341d08b587a3853f8bfe3b4210da291a56e0549c1f47c90

Contents?: true

Size: 707 Bytes

Versions: 6

Compression:

Stored size: 707 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
    end

    def message
      "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

6 entries across 6 versions & 1 rubygems

Version Path
aasm-4.12.1 lib/aasm/errors.rb
aasm-4.12.0 lib/aasm/errors.rb
aasm-4.11.1 lib/aasm/errors.rb
aasm-4.11.0 lib/aasm/errors.rb
aasm-4.10.1 lib/aasm/errors.rb
aasm-4.10.0 lib/aasm/errors.rb