From 823936ca9ce5188d22ee58f6363b2fe4e6440923 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 2 Oct 2017 12:04:59 -0400 Subject: [PATCH] A plugin API to catch exceptions --- lib/plugin/instance.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index e84ab6e413e..db1c866baf1 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -109,6 +109,12 @@ class Plugin::Instance end end + def rescue_from(exception, &block) + reloadable_patch do |plugin| + ::ApplicationController.rescue_from(exception, &block) + end + end + # Extend a class but check that the plugin is enabled # for class methods use `add_class_method` def add_to_class(class_name, attr, &block)