lib/onstomp/interfaces/event_manager.rb in onstomp-1.0.6 vs lib/onstomp/interfaces/event_manager.rb in onstomp-1.0.7
- old
+ new
@@ -25,10 +25,16 @@
# Triggers an event by the given name, passing along any additional
# `args` as parameters to the callback
# @param [Symbol] event_name event to trigger
# @param [Object, Object, ...] args
def trigger_event(event_name, *args)
- event_callbacks[event_name].each { |cb| cb.call(*args) }
+ event_callbacks[event_name].each do |cb|
+ begin
+ cb.call(*args)
+ rescue Exception => ex
+ warn "[OnStomp/Event] triggering #{event_name} raised an error: #{ex}"
+ end
+ end
end
# Mixin to allow includers to define custom event methods
module ClassMethods
# A convenient way to get a list of all of the event methods a class