exceptio-ruby 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.rdoc +17 -1
  2. data/lib/exceptio/client.rb +26 -2
  3. metadata +3 -3
data/README.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = exceptio-ruby
2
2
 
3
+ {<img src="https://secure.travis-ci.org/kickcode/exceptio-ruby.png" />}[http://travis-ci.org/kickcode/exceptio-ruby]
4
+
3
5
  * http://github.com/kickcode/exceptio-ruby
4
6
 
5
7
  == DESCRIPTION:
@@ -26,6 +28,20 @@ For Rails 2.3 and Rails 3 apps, exceptions should now automatically track. They
26
28
 
27
29
  ExceptIO::Client.configure "app-name", "api-key" if ["staging", "production"].include?(Rails.env)
28
30
 
31
+ If you'd like to ignore certain types of exceptions, you can add those exception types to the ignored exceptions list, or override the defaults entirely.
32
+
33
+ You can see the current defaults with:
34
+
35
+ ExceptIO::Client::DEFAULT_IGNORED_EXCEPTIONS
36
+
37
+ To add other exceptions to this list, you can add a line like this to your initializer:
38
+
39
+ ExceptIO::Client.ignored_exceptions << "IgnoredException"
40
+
41
+ To override the default list entirely, you can add a line like this:
42
+
43
+ ExceptIO::Client.ignored_exceptions = ["IgnoredException"]
44
+
29
45
  If you are using something other than Rails, or have additional areas outside of the controllers that you want to track exceptions for, you can make a call to log an exception directly:
30
46
 
31
47
  ExceptIO::Client.log @exception, "environment", params_hash, session_hash, "http://request/url"
@@ -48,7 +64,7 @@ Elliott Draper
48
64
 
49
65
  == LICENSE:
50
66
 
51
- Copyright 2011 Elliott Draper <el@kickcode.com>
67
+ Copyright 2012 Elliott Draper <el@kickcode.com>
52
68
 
53
69
  Permission is hereby granted, free of charge, to any person obtaining
54
70
  a copy of this software and associated documentation files (the
@@ -4,6 +4,8 @@ module ExceptIO
4
4
  class Client
5
5
  include HTTParty
6
6
 
7
+ DEFAULT_IGNORED_EXCEPTIONS = ["ActiveRecord::RecordNotFound", "ActionController::InvalidAuthenticityToken", "ActionController::RoutingError"]
8
+
7
9
  def self.configure(application, app_key, endpoint = 'except.io')
8
10
  @application = application
9
11
  @app_key = app_key
@@ -18,15 +20,37 @@ module ExceptIO
18
20
  end
19
21
  end
20
22
 
23
+ def self.configured
24
+ @configured
25
+ end
26
+
27
+ def self.application
28
+ @application
29
+ end
30
+
31
+ def self.app_key
32
+ @app_key
33
+ end
34
+
35
+ def self.ignored_exceptions
36
+ @ignored_exceptions ||= DEFAULT_IGNORED_EXCEPTIONS.clone
37
+ end
38
+
39
+ def self.ignored_exceptions=(ignored_exceptions)
40
+ @ignored_exceptions = ignored_exceptions
41
+ end
42
+
21
43
  def self.reset!
22
44
  @application = nil
23
45
  @app_key = nil
24
46
  @configured = false
47
+ @ignored_exceptions = DEFAULT_IGNORED_EXCEPTIONS.clone
25
48
  end
26
49
 
27
50
  def self.log(exception, environment = "production", params = {}, session = {}, request_url = nil)
28
- return false unless @configured
29
- res = self.post("/applications/#{@application}/errors", {:query => {:app_key => @app_key}, :body => {:error => {:message => exception.message, :backtrace => exception.backtrace, :environment => environment, :params => params, :session => session, :request_url => request_url}}})
51
+ return false unless self.configured
52
+ return false if self.ignored_exceptions.map(&:to_s).include?(exception.class.name)
53
+ res = self.post("/applications/#{self.application}/errors", {:query => {:app_key => self.app_key}, :body => {:error => {:message => exception.message, :backtrace => exception.backtrace, :type => exception.class.name, :environment => environment, :params => params, :session => session, :request_url => request_url}}})
30
54
  res.code == 201
31
55
  end
32
56
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Elliott Draper
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-02-08 00:00:00 +00:00
17
+ date: 2012-04-07 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency