err 0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/CHANGELOG.md +5 -0
- data/README.md +88 -9
- data/Rakefile +15 -0
- data/err.gemspec +3 -0
- data/lib/err/configuration.rb +38 -0
- data/lib/err/services/airbrake.rb +25 -9
- data/lib/err/services/honeybadger.rb +41 -0
- data/lib/err/services/opbeat.rb +46 -0
- data/lib/err/services/service.rb +37 -0
- data/lib/err/services.rb +3 -0
- data/lib/err/version.rb +1 -1
- data/lib/err.rb +45 -3
- data/test/err_test.rb +4 -0
- data/test/services/airbrake_test.rb +56 -0
- data/test/services/honeybadger_test.rb +56 -0
- data/test/services/opbeat_test.rb +56 -0
- data/test/test_helper.rb +12 -0
- metadata +62 -4
- data/lib/err/service.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07affa7e7938f1ac3388a2bf05a7aa62de6ccc78
|
4
|
+
data.tar.gz: c3197404a39f79fcb7a3bf617bc7336f41074193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d562d4917ee2b3d23feb9c395bff1143a33acc25308be38979f3e043ff8d124dcaf029700dca1cf7e06aa18459eb0870189ce11ce0ea9c153eeb01d38230a12f
|
7
|
+
data.tar.gz: 1666098f7ac9ae2dd0cfe9ede947fc3e18fc60e2b4141a5bf60c03a6e68b239c31de5e2ccd0b70020a00e4ae2d1e36706c4fc2f24b48c9b3c0ca1219ea2b850c
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Err
|
2
2
|
|
3
|
-
|
3
|
+
Err helps you try out and use different error notification gems without the hassle of individual setup.
|
4
|
+
It adds a simple API that you can use to set up all your notification gems in one place.
|
5
|
+
|
6
|
+
Err works with or without Rails.
|
7
|
+
|
8
|
+
**Supported services:** [Airbrake](https://github.com/airbrake/airbrake), [Honeybadger](https://github.com/honeybadger-io/honeybadger-ruby) and [Opbeat](https://github.com/opbeat/opbeat_ruby).
|
9
|
+
If you use a service that isn't listed here, please [add it](#contributing) so others can use it too. Thanks :heart:
|
4
10
|
|
5
11
|
## Installation
|
6
12
|
|
@@ -12,18 +18,91 @@ And then execute:
|
|
12
18
|
|
13
19
|
$ bundle
|
14
20
|
|
15
|
-
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
To use a service, just add its Ruby gem to your *Gemfile* and set it up as shown below.
|
16
24
|
|
17
|
-
|
25
|
+
Example configuration, in an initializer, e.g. *config/initializers/err.rb*:
|
18
26
|
|
19
|
-
|
27
|
+
```ruby
|
28
|
+
Err.configure do |config|
|
29
|
+
# Set up shared configuration
|
30
|
+
config.environments = %w{ staging production }
|
31
|
+
config.ignore << "Some::Exception"
|
32
|
+
|
33
|
+
# Set up Airbrake
|
34
|
+
config.airbrake do |config|
|
35
|
+
config.api_key = 'some key'
|
36
|
+
end
|
37
|
+
|
38
|
+
# Set up Honeybadger
|
39
|
+
config.honeybadger do |config|
|
40
|
+
config.api_key = 'some key'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Set up Opbeat
|
44
|
+
config.opbeat do |config|
|
45
|
+
config.organization_id = 'some organization id'
|
46
|
+
config.app_id = 'some app id'
|
47
|
+
config.secret_token = 'some secret token'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
If you prefer to have the individual services set up in different initializers, you can do the following:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
Err.configure :airbrake do |config|
|
56
|
+
config.api_key = 'some key'
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
If you don't use Rails, you can do this anywhere in your application setup, as long as the service gems are loaded in advance.
|
61
|
+
|
62
|
+
To remove a service, just remove its Ruby gem from the *Gemfile*. You can leave the config if you wish, so you can use it at a later time. It won't get called if the service's Ruby gem isn't available.
|
20
63
|
|
21
|
-
|
64
|
+
## Defaults
|
65
|
+
|
66
|
+
Err sets up some defaults that makes it easy to try out new services without the common setup.
|
67
|
+
|
68
|
+
#### Ignored exceptions by default
|
69
|
+
|
70
|
+
#### Default notification environments
|
71
|
+
|
72
|
+
## Manually tracking exceptions
|
73
|
+
|
74
|
+
The various error notification gems will track errors automatically. In addition, Err adds a simple API for tracking exceptions and messages manually.
|
75
|
+
|
76
|
+
#### Sending an exception
|
77
|
+
|
78
|
+
The following will send an exception to all available services:
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
begin
|
82
|
+
# Some failing code
|
83
|
+
rescue => e
|
84
|
+
Err.notify e, some_param: "Some value"
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Sending a message
|
89
|
+
|
90
|
+
You can send a message manually that isn't an actual exception to all services:
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
Err.message "Something went wrong", this_is: "A param"
|
94
|
+
```
|
22
95
|
|
23
96
|
## Contributing
|
24
97
|
|
25
|
-
|
98
|
+
You are very welcome to add new error notification services so others can use them too.
|
99
|
+
See the [existing services](https://github.com/lassebunk/err/tree/master/lib/err/services) to see how this is done.
|
100
|
+
|
101
|
+
1. Fork the project
|
26
102
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3.
|
28
|
-
4.
|
29
|
-
5.
|
103
|
+
3. Make your changes
|
104
|
+
4. Add tests so others don't break it unintentionally
|
105
|
+
5. Run tests (`rake`)
|
106
|
+
6. Commit your changes (`git commit -am 'Add feature'`)
|
107
|
+
7. Push to the branch (`git push origin my-new-feature`)
|
108
|
+
8. Create a new pull request
|
data/Rakefile
CHANGED
@@ -1,2 +1,17 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
2
3
|
|
4
|
+
Rake::TestTask.new do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
7
|
+
t.verbose = true
|
8
|
+
end
|
9
|
+
|
10
|
+
task :console do
|
11
|
+
require "irb"
|
12
|
+
require "err"
|
13
|
+
ARGV.clear
|
14
|
+
IRB.start
|
15
|
+
end
|
16
|
+
|
17
|
+
task :default => :test
|
data/err.gemspec
CHANGED
@@ -20,8 +20,11 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_development_dependency "bundler", "~> 1.6"
|
22
22
|
s.add_development_dependency "rake"
|
23
|
+
s.add_development_dependency "mocha", "~> 1.1"
|
24
|
+
s.add_development_dependency "minitest"
|
23
25
|
|
24
26
|
# Services
|
25
27
|
s.add_development_dependency "airbrake"
|
28
|
+
s.add_development_dependency "honeybadger"
|
26
29
|
s.add_development_dependency "opbeat"
|
27
30
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Err
|
2
|
+
module Configuration
|
3
|
+
DEFAULT_DEVELOPMENT_ENVIRONMENTS = %w{ development test cucumber }
|
4
|
+
DEFAULT_IGNORE = %w{
|
5
|
+
ActiveRecord::RecordNotFound,
|
6
|
+
ActionController::RoutingError,
|
7
|
+
ActionController::InvalidAuthenticityToken,
|
8
|
+
CGI::Session::CookieStore::TamperedWithCookie,
|
9
|
+
ActionController::UnknownHttpMethod,
|
10
|
+
ActionController::UnknownAction,
|
11
|
+
AbstractController::ActionNotFound,
|
12
|
+
Mongoid::Errors::DocumentNotFound,
|
13
|
+
ActionController::UnknownFormat
|
14
|
+
}
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def development_environments
|
18
|
+
@development_environments ||= DEFAULT_DEVELOPMENT_ENVIRONMENTS.dup
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_writer :development_environments
|
22
|
+
|
23
|
+
def ignore
|
24
|
+
@ignore ||= DEFAULT_IGNORE.dup
|
25
|
+
end
|
26
|
+
|
27
|
+
attr_writer :ignore
|
28
|
+
|
29
|
+
def method_missing(method, *args, &block)
|
30
|
+
if service = Err.find_service_by_key(method)
|
31
|
+
service.configure(&block) if service.enabled?
|
32
|
+
else
|
33
|
+
super
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,24 +1,40 @@
|
|
1
1
|
module Err
|
2
2
|
class Airbrake < Service
|
3
3
|
class << self
|
4
|
-
def
|
4
|
+
def available?
|
5
5
|
defined?(::Airbrake)
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def configure(&block)
|
9
|
+
return unless enabled?
|
10
|
+
airbrake.configure(&block)
|
10
11
|
end
|
11
12
|
|
12
|
-
def
|
13
|
-
|
13
|
+
def development_environments=(envs)
|
14
|
+
config.development_environments = envs.map(&:to_s)
|
14
15
|
end
|
15
16
|
|
16
|
-
def
|
17
|
-
|
17
|
+
def ignore=(exception_names)
|
18
|
+
config.ignore.clear
|
19
|
+
config.ignore.concat exception_names
|
18
20
|
end
|
19
21
|
|
20
|
-
def
|
21
|
-
|
22
|
+
def notify(exception, params = {})
|
23
|
+
airbrake.notify_or_ignore(exception, parameters: params)
|
24
|
+
end
|
25
|
+
|
26
|
+
def message(msg, params = {})
|
27
|
+
airbrake.notify(msg, parameters: params)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def airbrake
|
33
|
+
::Airbrake
|
34
|
+
end
|
35
|
+
|
36
|
+
def config
|
37
|
+
airbrake.configuration
|
22
38
|
end
|
23
39
|
end
|
24
40
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Err
|
2
|
+
class Honeybadger < Service
|
3
|
+
class << self
|
4
|
+
def available?
|
5
|
+
defined?(::Honeybadger)
|
6
|
+
end
|
7
|
+
|
8
|
+
def configure(&block)
|
9
|
+
return unless enabled?
|
10
|
+
honeybadger.configure(&block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def development_environments=(envs)
|
14
|
+
config.development_environments = envs.map(&:to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
def ignore=(exception_names)
|
18
|
+
config.ignore.clear
|
19
|
+
config.ignore.concat exception_names
|
20
|
+
end
|
21
|
+
|
22
|
+
def notify(exception, params = {})
|
23
|
+
honeybadger.notify_or_ignore(exception, parameters: params)
|
24
|
+
end
|
25
|
+
|
26
|
+
def message(msg, params = {})
|
27
|
+
honeybadger.notify(msg, parameters: params)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def honeybadger
|
33
|
+
::Honeybadger
|
34
|
+
end
|
35
|
+
|
36
|
+
def config
|
37
|
+
honeybadger.configuration
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Err
|
2
|
+
class Opbeat < Service
|
3
|
+
class << self
|
4
|
+
def available?
|
5
|
+
defined?(::Opbeat)
|
6
|
+
end
|
7
|
+
|
8
|
+
def configure(&block)
|
9
|
+
return unless enabled?
|
10
|
+
opbeat.configure(&block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def development_environments=(envs)
|
14
|
+
config.environments = [config.current_environment] - envs.map(&:to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
def ignore=(exception_names)
|
18
|
+
config.excluded_exceptions = exception_names
|
19
|
+
end
|
20
|
+
|
21
|
+
def notify(exception, params = {})
|
22
|
+
opbeat.captureException(exception)
|
23
|
+
end
|
24
|
+
|
25
|
+
def message(msg, params = {})
|
26
|
+
msg = msg.dup
|
27
|
+
msg << " (#{params_string(params)})" if params.any?
|
28
|
+
opbeat.captureMessage(msg)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def params_string(params)
|
34
|
+
params.map { |k, v| "#{k}: #{v}" }.join(", ")
|
35
|
+
end
|
36
|
+
|
37
|
+
def opbeat
|
38
|
+
::Opbeat
|
39
|
+
end
|
40
|
+
|
41
|
+
def config
|
42
|
+
opbeat.configuration
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Err
|
2
|
+
class Service
|
3
|
+
class << self
|
4
|
+
def key
|
5
|
+
@key ||= name.split("::").last.gsub(/^./, &:downcase).gsub(/[A-Z]/) { |s| "_#{s.downcase}" }
|
6
|
+
end
|
7
|
+
|
8
|
+
def available?
|
9
|
+
raise NotImplementedError
|
10
|
+
end
|
11
|
+
|
12
|
+
def enabled?
|
13
|
+
available?
|
14
|
+
end
|
15
|
+
|
16
|
+
def configure(&block)
|
17
|
+
raise NotImplementedError
|
18
|
+
end
|
19
|
+
|
20
|
+
def development_environments=(envs)
|
21
|
+
raise NotImplementedError
|
22
|
+
end
|
23
|
+
|
24
|
+
def ignore=(exception_names)
|
25
|
+
raise NotImplementedError
|
26
|
+
end
|
27
|
+
|
28
|
+
def notify(exception, params = {})
|
29
|
+
raise NotImplementedError
|
30
|
+
end
|
31
|
+
|
32
|
+
def message(msg, params = {})
|
33
|
+
raise NotImplementedError
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/err/services.rb
ADDED
data/lib/err/version.rb
CHANGED
data/lib/err.rb
CHANGED
@@ -1,16 +1,58 @@
|
|
1
1
|
%w{
|
2
2
|
version
|
3
|
-
|
3
|
+
configuration
|
4
|
+
services
|
4
5
|
}.each { |f| require "err/#{f}" }
|
5
6
|
|
6
7
|
module Err
|
7
8
|
class << self
|
9
|
+
def configure(service_key = nil, &block)
|
10
|
+
if service_key
|
11
|
+
service = find_service_by_key(service_key)
|
12
|
+
raise "Service #{service_key.inspect} not found" unless service
|
13
|
+
service.configure(&block) if service.enabled?
|
14
|
+
else
|
15
|
+
yield config
|
16
|
+
end
|
17
|
+
setup!
|
18
|
+
end
|
19
|
+
|
20
|
+
def notify(exception, params = {})
|
21
|
+
call_each_service :notify, exception, params
|
22
|
+
end
|
23
|
+
|
24
|
+
def message(msg, params = {})
|
25
|
+
call_each_service :message, msg, params
|
26
|
+
end
|
27
|
+
|
8
28
|
def setup!
|
9
|
-
|
10
|
-
|
29
|
+
[:development_environments, :ignore].each do |method|
|
30
|
+
call_each_service "#{method}=", config.send(method)
|
31
|
+
end
|
11
32
|
end
|
12
33
|
|
13
34
|
def services
|
35
|
+
@services ||= ObjectSpace.each_object(Class).select { |klass| klass < Err::Service }
|
36
|
+
end
|
37
|
+
|
38
|
+
def enabled_services
|
39
|
+
services.select(&:enabled?)
|
40
|
+
end
|
41
|
+
|
42
|
+
def find_service_by_key(key)
|
43
|
+
services.find { |s| s.key == key.to_s }
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def config
|
49
|
+
Configuration
|
50
|
+
end
|
51
|
+
|
52
|
+
def call_each_service(method, *args)
|
53
|
+
enabled_services.each do |s|
|
54
|
+
s.send method, *args
|
55
|
+
end
|
14
56
|
end
|
15
57
|
end
|
16
58
|
end
|
data/test/err_test.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class AirbrakeTest < Minitest::Test
|
4
|
+
def test_key
|
5
|
+
assert_equal "airbrake", Err::Airbrake.key
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_enabled
|
9
|
+
assert Err::Airbrake.enabled?
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_configure
|
13
|
+
Err.configure do |config|
|
14
|
+
config.airbrake do |config|
|
15
|
+
config.api_key = "123"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
assert_equal "123", Airbrake.configuration.api_key
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_configure_separate
|
22
|
+
Err.configure :airbrake do |config|
|
23
|
+
config.api_key = "456"
|
24
|
+
end
|
25
|
+
assert_equal "456", Airbrake.configuration.api_key
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_configure_development_environments
|
29
|
+
Err.configure do |config|
|
30
|
+
config.development_environments = %w{development staging}
|
31
|
+
end
|
32
|
+
assert Airbrake.configuration.development_environments.include?("staging")
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_configure_ignore
|
36
|
+
Err.configure do |config|
|
37
|
+
config.ignore = %w{
|
38
|
+
ActiveRecord::RecordNotFound
|
39
|
+
ActionController::RoutingError
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_equal %w{ ActiveRecord::RecordNotFound ActionController::RoutingError },
|
44
|
+
Airbrake.configuration.ignore
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_notify
|
48
|
+
Airbrake.expects(:notify_or_ignore).once
|
49
|
+
Err::Airbrake.notify RuntimeError.new
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_message
|
53
|
+
Airbrake.expects(:notify).once
|
54
|
+
Err::Airbrake.message "This is a test", one: "First", two: "Second"
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class HoneybadgerTest < Minitest::Test
|
4
|
+
def test_key
|
5
|
+
assert_equal "honeybadger", Err::Honeybadger.key
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_enabled
|
9
|
+
assert Err::Honeybadger.enabled?
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_configure
|
13
|
+
Err.configure do |config|
|
14
|
+
config.honeybadger do |config|
|
15
|
+
config.api_key = "123"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
assert_equal "123", Honeybadger.configuration.api_key
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_configure_separate
|
22
|
+
Err.configure :honeybadger do |config|
|
23
|
+
config.api_key = "456"
|
24
|
+
end
|
25
|
+
assert_equal "456", Honeybadger.configuration.api_key
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_configure_development_environments
|
29
|
+
Err.configure do |config|
|
30
|
+
config.development_environments = %w{development staging}
|
31
|
+
end
|
32
|
+
assert Honeybadger.configuration.development_environments.include?("staging")
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_configure_ignore
|
36
|
+
Err.configure do |config|
|
37
|
+
config.ignore = %w{
|
38
|
+
ActiveRecord::RecordNotFound
|
39
|
+
ActionController::RoutingError
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_equal %w{ ActiveRecord::RecordNotFound ActionController::RoutingError },
|
44
|
+
Honeybadger.configuration.ignore
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_notify
|
48
|
+
Honeybadger.expects(:notify_or_ignore).once
|
49
|
+
Err::Honeybadger.notify RuntimeError.new
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_message
|
53
|
+
Honeybadger.expects(:notify).once
|
54
|
+
Err::Honeybadger.message "This is a test", one: "First", two: "Second"
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class OpbeatTest < Minitest::Test
|
4
|
+
def test_key
|
5
|
+
assert_equal "opbeat", Err::Opbeat.key
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_enabled
|
9
|
+
assert Err::Opbeat.enabled?
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_configure
|
13
|
+
Err.configure do |config|
|
14
|
+
config.opbeat do |config|
|
15
|
+
config.organization_id = "123"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
assert_equal "123", Opbeat.configuration.organization_id
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_configure_separate
|
22
|
+
Err.configure :opbeat do |config|
|
23
|
+
config.organization_id = "456"
|
24
|
+
end
|
25
|
+
assert_equal "456", Opbeat.configuration.organization_id
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_configure_development_environments
|
29
|
+
Err.configure do |config|
|
30
|
+
config.development_environments = %w{development production}
|
31
|
+
end
|
32
|
+
assert !Opbeat.configuration.environments.include?("production")
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_configure_ignore
|
36
|
+
Err.configure do |config|
|
37
|
+
config.ignore = %w{
|
38
|
+
ActiveRecord::RecordNotFound
|
39
|
+
ActionController::RoutingError
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_equal %w{ ActiveRecord::RecordNotFound ActionController::RoutingError },
|
44
|
+
Opbeat.configuration.excluded_exceptions
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_notify
|
48
|
+
Opbeat.expects(:captureException).once
|
49
|
+
Err::Opbeat.notify RuntimeError.new
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_message
|
53
|
+
Opbeat.expects(:captureMessage).once
|
54
|
+
Err::Opbeat.message "This is a test", one: "First", two: "Second"
|
55
|
+
end
|
56
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: err
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lasse Bunk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: airbrake
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +80,20 @@ dependencies:
|
|
52
80
|
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: honeybadger
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: opbeat
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,15 +117,26 @@ extensions: []
|
|
75
117
|
extra_rdoc_files: []
|
76
118
|
files:
|
77
119
|
- ".gitignore"
|
120
|
+
- ".travis.yml"
|
121
|
+
- CHANGELOG.md
|
78
122
|
- Gemfile
|
79
123
|
- LICENSE.txt
|
80
124
|
- README.md
|
81
125
|
- Rakefile
|
82
126
|
- err.gemspec
|
83
127
|
- lib/err.rb
|
84
|
-
- lib/err/
|
128
|
+
- lib/err/configuration.rb
|
129
|
+
- lib/err/services.rb
|
85
130
|
- lib/err/services/airbrake.rb
|
131
|
+
- lib/err/services/honeybadger.rb
|
132
|
+
- lib/err/services/opbeat.rb
|
133
|
+
- lib/err/services/service.rb
|
86
134
|
- lib/err/version.rb
|
135
|
+
- test/err_test.rb
|
136
|
+
- test/services/airbrake_test.rb
|
137
|
+
- test/services/honeybadger_test.rb
|
138
|
+
- test/services/opbeat_test.rb
|
139
|
+
- test/test_helper.rb
|
87
140
|
homepage: https://github.com/lassebunk/err
|
88
141
|
licenses:
|
89
142
|
- MIT
|
@@ -108,4 +161,9 @@ rubygems_version: 2.2.2
|
|
108
161
|
signing_key:
|
109
162
|
specification_version: 4
|
110
163
|
summary: Switch out error notification apps like MultiJSON.
|
111
|
-
test_files:
|
164
|
+
test_files:
|
165
|
+
- test/err_test.rb
|
166
|
+
- test/services/airbrake_test.rb
|
167
|
+
- test/services/honeybadger_test.rb
|
168
|
+
- test/services/opbeat_test.rb
|
169
|
+
- test/test_helper.rb
|
data/lib/err/service.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Err
|
2
|
-
class Service
|
3
|
-
class << self
|
4
|
-
def enabled?
|
5
|
-
raise NotImplementedError
|
6
|
-
end
|
7
|
-
|
8
|
-
def environments=(envs)
|
9
|
-
raise NotImplementedError
|
10
|
-
end
|
11
|
-
|
12
|
-
def ignored=(exception_names)
|
13
|
-
raise NotImplementedError
|
14
|
-
end
|
15
|
-
|
16
|
-
def notify(exception)
|
17
|
-
raise NotImplementedError
|
18
|
-
end
|
19
|
-
|
20
|
-
def message(msg)
|
21
|
-
raise NotImplementedError
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|