Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Don't break application if a hook fails

Oliver Günthere77162c1dd26
diff --git a/lib/redmine/hook.rb b/lib/redmine/hook.rb
index 5b4a20358ff..4fa79050b07 100644
--- a/lib/redmine/hook.rb
+++ b/lib/redmine/hook.rb
@@ -68,9 +68,11 @@ module Redmine
# Returns the listeners response.
def call_hook(hook, context = {})
[].tap do |response|
- hls = hook_listeners(hook)
- if hls.any?
- hls.each { |listener| response << listener.send(hook, context) }
+ hook_listeners(hook).each do |listener|
+ response << listener.send(hook, context)
+ rescue StandardError => e
+ msg = "Failed to collect hook response for #{hook} from #{listener.inspect}"
+ ::OpenProject.logger.error(msg, exception: e, extra: { hook_name: hook })
end
end
end