Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add error suppression option

  • Loading branch information...
commit 0e39dd38e216ddefe6f7bcbc2eb3daf796395e14 1 parent 77547e8
Jacques Crocker authored June 12, 2011
1  lib/aarrr/config.rb
@@ -34,6 +34,7 @@ def option(name, options = {})
34 34
     option :cookie_expiration, :default => 60*24*60*60
35 35
     option :user_collection_name, :default => "aarrr_users"
36 36
     option :event_collection_name, :default => "aarrr_events"
  37
+    option :suppress_errors, :default => false
37 38
 
38 39
     # Get the Mongo::Connection to use to pull the AARRR metrics data
39 40
     def connection
13  lib/aarrr/session.rb
@@ -27,6 +27,12 @@ def initialize(env_or_object = nil, attributes = nil)
27 27
         AARRR.users.update({"_id" => id}, attributes, :upsert => true)
28 28
       end
29 29
 
  30
+    rescue Exception => e
  31
+      if AARRR.suppress_errors
  32
+        puts "Unable to log metrics: #{e.to_s}"
  33
+      else
  34
+        raise e
  35
+      end
30 36
     end
31 37
 
32 38
     # returns a reference the othe AARRR user
@@ -75,6 +81,13 @@ def track(event_name, options = {})
75 81
       })
76 82
 
77 83
       result
  84
+
  85
+    rescue Exception => e
  86
+      if AARRR.suppress_errors
  87
+        puts "Unable to log metrics: #{e.to_s}"
  88
+      else
  89
+        raise e
  90
+      end
78 91
     end
79 92
 
80 93
     def track!(event_name, options = {})

0 notes on commit 0e39dd3

Please sign in to comment.
Something went wrong with that request. Please try again.