Created
January 12, 2015 23:38
-
-
Save Jacobkg/6b8010e2c58d2d1750b1 to your computer and use it in GitHub Desktop.
Celluloid Thread.current
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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