Sha256: 9cca11175d7b97aa6698fabccb100460cc96369248ef1c85fb6846251a703cce
Contents?: true
Size: 626 Bytes
Versions: 16
Compression:
Stored size: 626 Bytes
Contents
require 'timeout' module RescueExt def rescue_all default = nil, silent = false begin return yield rescue Exception => e unless silent Rails.logger.warn "Exception rescued:" Rails.logger.warn e if e.respond_to? :io Rails.logger.warn "URI: '#{e.io.meta['location']}'" end Rails.logger.warn e.backtrace.join("\n") end return default end end def silently_rescue_all default = nil, &block rescue_all default, true, &block end def timeout sec, default = nil rescue_all(default) {Timeout.timeout(sec) { yield }} end end
Version data entries
16 entries across 16 versions & 2 rubygems