Skip to content

Instantly share code, notes, and snippets.

@Jacobkg
Created January 12, 2015 23:38
Show Gist options
  • Save Jacobkg/6b8010e2c58d2d1750b1 to your computer and use it in GitHub Desktop.
Save Jacobkg/6b8010e2c58d2d1750b1 to your computer and use it in GitHub Desktop.
Celluloid Thread.current
require 'celluloid/autostart'
class ExceptionHandler
def self.notify(e)
puts "Something has gone wrong" unless Thread.current[:context]
end
end
Celluloid.exception_handler { |e| ExceptionHandler.notify(e) }
Celluloid.logger = Logger.new('/dev/null')
class Worker
include Celluloid
def run
Thread.current[:context] = "The Error Context"
raise "WAT"
end
end
Worker.new.async.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment