# File lib/sup/hook.rb, line 76 def run name, locals={} hook = hook_for(name) or return context = @contexts[hook] ||= HookContext.new(name) result = nil fn = fn_for name begin result = context.__run hook, fn, locals rescue Exception => e log "error running #{fn}: #{e.message}" log e.backtrace.join("\n") @hooks[name] = nil # disable it BufferManager.flash "Error running hook: #{e.message}" if BufferManager.instantiated? end result end