Sha256: 368714625df8ea071965cbde6a3817957cea75d1b7f7840b5c035a8c05d852fe
Contents?: true
Size: 836 Bytes
Versions: 13
Compression:
Stored size: 836 Bytes
Contents
module Houston # Rescues exceptions and reports them def self.async(do_async=true) return yield unless do_async Thread.new do ActiveRecord::Base.connection_pool.with_connection do begin yield rescue Exception # rescues StandardError by default; but we want to rescue and report all errors Houston.report_exception($!) ensure Rails.logger.flush # http://stackoverflow.com/a/3516003/731300 end end end end # Allows exceptions to bubble up def self.async!(do_async=true) return yield unless do_async Thread.new do ActiveRecord::Base.connection_pool.with_connection do begin yield ensure Rails.logger.flush # http://stackoverflow.com/a/3516003/731300 end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems