Added Errbase so errors are not silent by default

Andrew Kane committed Nov 02, 2014
commit 886e66c41de0249c36a316c7de8817374d94725f
Showing 6 changed files with 14 additions and 3 deletions
CHANGELOG.md +2 -1
@@ @@ -1,6 +1,7 @@
- ## 1.0.3 [unreleased]
+ ## 1.1.0 [unreleased]
- Added `geocode` option
+ - Report errors to service by default
- Fixed association mismatch
## 1.0.2
README.md +3 -1
@@ @@ -215,7 +215,9 @@ end
Exceptions are rescued so analytics do not break your app.
- To report them to a service, use:
+ Ahoy uses [Errbase](https://github.com/ankane/errbase) to try to report them to a service by default.
+
+ To customize this, use:
```ruby
class Ahoy::Store < Ahoy::Stores::ActiveRecordStore
ahoy_matey.gemspec +1 -0
@@ @@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "user_agent_parser"
spec.add_dependency "request_store"
spec.add_dependency "uuidtools"
+ spec.add_dependency "errbase"
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
ahoy.rb b/lib/ahoy.rb +1 -0
@@ @@ -5,6 +5,7 @@ require "referer-parser"
require "user_agent_parser"
require "request_store"
require "uuidtools"
+ require "errbase"
require "ahoy/version"
require "ahoy/tracker"
ahoy/stores/base_store.rb b/lib/ahoy/stores/base_store.rb +1 -0
@@ @@ -28,6 +28,7 @@ module Ahoy
end
def report_exception(e)
+ Errbase.report(e)
end
def user
ahoy/tracker.rb b/lib/ahoy/tracker.rb +6 -1
@@ @@ -119,7 +119,12 @@ module Ahoy
end
def report_exception(e)
- @store.report_exception(e)
+ begin
+ @store.report_exception(e)
+ rescue
+ # fail-safe
+ $stderr.puts "Error reporting exception"
+ end
if Rails.env.development?
raise e
end