aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/concerns/control_flow.rb
diff options
context:
space:
mode:
authorteddywing2017-08-02 14:48:01 +0200
committerGitHub2017-08-02 14:48:01 +0200
commitbdb416b2b974bf5e9c36eabf19af9ee3cc5feed7 (patch)
tree0f83fb65d26b615ca4d19e45966fcf420352bcaf /app/controllers/concerns/control_flow.rb
parentf4a879becb6ac5f3229f77e8a14122f085e02be5 (diff)
parentbfc4aa67c0ff06aaafbade489fa210970aaf2763 (diff)
downloadchouette-core-bdb416b2b974bf5e9c36eabf19af9ee3cc5feed7.tar.bz2
Merge pull request #51 from af83/4176_1726_neteximp_autocreate_ref
4176 1726 neteximp autocreate ref
Diffstat (limited to 'app/controllers/concerns/control_flow.rb')
-rw-r--r--app/controllers/concerns/control_flow.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/concerns/control_flow.rb b/app/controllers/concerns/control_flow.rb
new file mode 100644
index 000000000..0f41a1cda
--- /dev/null
+++ b/app/controllers/concerns/control_flow.rb
@@ -0,0 +1,14 @@
+module ControlFlow
+ FinishAction = Class.new RuntimeError
+
+ def self.included into
+ into.rescue_from FinishAction, with: :catch_finish_action
+ end
+
+ # Allow to exit locally inside an action after rendering (especially in error cases)
+ def catch_finish_action; end
+
+ def finish_action! msg = 'finish action'
+ raise FinishAction, msg
+ end
+end