lib/submodules/ably-ruby/lib/ably/modules/safe_yield.rb in ably-rest-0.8.6 vs lib/submodules/ably-ruby/lib/ably/modules/safe_yield.rb in ably-rest-0.8.9
- old
+ new
@@ -11,20 +11,20 @@
# @api private
module SafeYield
private
def safe_yield(block, *args)
- block.call *args
+ block.call(*args)
rescue StandardError => e
message = "An exception in an external block was caught. #{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
safe_yield_log_error message
end
def safe_yield_log_error(message)
if defined?(:logger) && logger.respond_to?(:error)
return logger.error message
end
- rescue StandardError => e
+ rescue StandardError
fallback_logger.error message
end
def fallback_logger
@fallback_logger ||= ::Logger.new(STDOUT).tap do |logger|