Skip to content

Commit

Permalink
udpate ErrorHandler docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zyskowsk committed Jun 25, 2015
1 parent cacd6ce commit 76fbbff
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/mixpanel-ruby/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Mixpanel

# Mixpanel specific errors that are thrown in the gem.
# In the default consumer we catch all errors and raise
# Mixpanel specific errors that can be handled in a custom
# Error handler.
# Mixpanel specific errors that can be handled using a
# custom error handler.
class MixpanelError < StandardError
end

Expand All @@ -16,8 +16,8 @@ class ServerError < MixpanelError

# The default behavior of the gem is to silence all errors
# thrown in the consumer. If you wish to handle MixpanelErrors
# yourself you should pass a class that extends ErrorHandler to
# the Tracker on initialize:
# yourself you can pass an instance of a class that extends
# Mixpanel::ErrorHandler to Mixpanel::Tracker on initialize.
#
# require 'logger'
#
Expand All @@ -30,16 +30,17 @@ class ServerError < MixpanelError
#
# def handle(error)
# logger.error "#{error.inspect}\n Backtrace: #{error.backtrace}"
# end
# end
#
# end
# end
#
# my_error_handler = MyErrorHandler.new
# tracker = Mixpanel::Tracker.new(YOUR_MIXPANEL_TOKEN, my_error_handler)
class ErrorHandler

# Override #handle to customize error handling
def handle(error)
# Override this method to customize error handling within mixpanel-ruby
false
end
end
end

0 comments on commit 76fbbff

Please sign in to comment.