mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
A plugin API to catch exceptions
This commit is contained in:
parent
47e79570cc
commit
823936ca9c
1 changed files with 6 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue