lib/signalize.rb in signalize-1.0.0 vs lib/signalize.rb in signalize-1.0.1

- old
+ new

@@ -15,11 +15,11 @@ end end end def self.cycle_detected - raise "Cycle detected" + raise Signalize::Error, "Cycle detected" end RUNNING = 1 << 0 NOTIFIED = 1 << 1 OUTDATED = 1 << 2 @@ -337,11 +337,11 @@ cleanup_effect(effect) end def end_effect(effect, prev_context, *_) # allow additional args for currying - raise "Out-of-order effect" if eval_context != effect + raise Signalize::Error, "Out-of-order effect" if eval_context != effect cleanup_sources(effect) self.eval_context = prev_context effect._flags &= ~RUNNING @@ -584,11 +584,16 @@ def _callback finis = _start begin + compute_executed = false @_cleanup = _compute.() if (@_flags & DISPOSED).zero? && @_compute.nil?.! + compute_executed = true ensure + unless compute_executed + raise Signalize::Error, "Early return or break detected in effect block" + end finis.(nil) # TODO: figure out this weird shit end end def _start