lib/statesman/events.rb in statesman-events-0.0.1 vs lib/statesman/events.rb in statesman-events-1.0.0

- old
+ new

@@ -20,25 +20,25 @@ end end def trigger!(event_name, metadata = {}) transitions = self.class.events.fetch(event_name) do - raise Statesman::TransitionFailedError, + raise Statesman::InvalidTransitionError, "Event #{event_name} not found" end new_state = transitions.fetch(current_state) do - raise Statesman::TransitionFailedError, + raise Statesman::InvalidTransitionError, "State #{current_state} not found for Event #{event_name}" end transition_to!(new_state.first, metadata) true end def trigger(event_name, metadata = {}) self.trigger!(event_name, metadata) - rescue Statesman::TransitionFailedError, Statesman::GuardFailedError + rescue Statesman::InvalidTransitionError, Statesman::GuardFailedError false end def available_events state = current_state