lib/floe/workflow/states/non_terminal_mixin.rb in floe-0.11.0 vs lib/floe/workflow/states/non_terminal_mixin.rb in floe-0.11.3
- old
+ new
@@ -2,15 +2,17 @@
module Floe
class Workflow
module States
module NonTerminalMixin
- def finish
- context.next_state = end? ? nil : @next
+ def finish(context)
+ # If this state is failed or this is an end state, next_state to nil
+ context.next_state ||= end? || context.failed? ? nil : @next
+
super
end
- def validate_state_next!
+ def validate_state_next!(workflow)
raise Floe::InvalidWorkflowError, "Missing \"Next\" field in state [#{name}]" if @next.nil? && !@end
raise Floe::InvalidWorkflowError, "\"Next\" [#{@next}] not in \"States\" for state [#{name}]" if @next && !workflow.payload["States"].key?(@next)
end
end
end