FEATURE: Discoruse.handle_exception

to report exception via sidekiq helper, adds extra context
This commit is contained in:
Sam Saffron
2014-02-21 14:30:25 +11:00
parent d95887c57d
commit 2ab76f60d1
4 changed files with 39 additions and 6 deletions

View File

@@ -116,5 +116,24 @@ describe Discourse do
end
context "#handle_exception" do
class TempLogger
attr_accessor :exception, :context
def handle_exception(exception, context)
self.exception = exception
self.context = context
end
end
it "should not fail when called" do
logger = TempLogger.new
exception = StandardError.new
Discourse.handle_exception(exception, nil, logger)
logger.exception.should == exception
logger.context.keys.should == [:current_db, :current_hostname]
end
end
end