exceptiontrap 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -33
- data/lib/exceptiontrap.rb +0 -15
- data/lib/exceptiontrap/railtie.rb +1 -1
- data/lib/exceptiontrap/version.rb +1 -1
- metadata +1 -2
- data/lib/exceptiontrap/catcher.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94d20c5df4fb176e85f10232a44a22cdb7987420b33b32d6ff0ccb10ff332009
|
4
|
+
data.tar.gz: e094b9f56ae78202925dbed626f4818efeecb58234e1ce46aba0c9d339b7528e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d230c8706068beee1481f062d09efe8d78b221142cb78c04c64cf79b2725da3e292107f55676d0550734279ed35c1f5c2953bb47c4c63c312a3c2135874a9a18
|
7
|
+
data.tar.gz: 016c52a88837487b4821a08516429b3af9a0ab7f31fc611ab84467b7b7992f57aea01007a6d1a5ab179c19e144a9c94353ab349249ae24f63001788e9b624adf
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,14 +4,11 @@ This gem is used to catch and report your Ruby on Rails applications errors and
|
|
4
4
|
|
5
5
|
The gem is compatible with the following Rails versions
|
6
6
|
|
7
|
-
- >= 2.3
|
8
7
|
- 3, 4, and 5
|
9
8
|
|
10
9
|
## Setup
|
11
10
|
|
12
|
-
###
|
13
|
-
|
14
|
-
#### 1. Install
|
11
|
+
### 1. Install
|
15
12
|
|
16
13
|
Install the Exceptiontrap gem by putting this line to your `Gemfile`
|
17
14
|
|
@@ -19,7 +16,7 @@ Install the Exceptiontrap gem by putting this line to your `Gemfile`
|
|
19
16
|
|
20
17
|
then run `bundle`
|
21
18
|
|
22
|
-
|
19
|
+
### 2. Configure
|
23
20
|
|
24
21
|
Now generate the `config/exceptiontrap.yml` file with
|
25
22
|
|
@@ -29,34 +26,6 @@ and you should be fine.
|
|
29
26
|
|
30
27
|
**Note:** Some exceptions are ignored by default, e.g. `RoutingError` and `RecordNotFound` errors. You can change this behavior in the just generated `config/exceptiontrap.yml` file.
|
31
28
|
|
32
|
-
### Rails 2.3
|
33
|
-
|
34
|
-
#### 1a. Install (with Bundler)
|
35
|
-
|
36
|
-
Install the Exceptiontrap gem by putting this line to your `Gemfile`
|
37
|
-
|
38
|
-
gem 'exceptiontrap'
|
39
|
-
|
40
|
-
then run `bundle`
|
41
|
-
|
42
|
-
#### 1b. Install (without Bundler)
|
43
|
-
|
44
|
-
Install the Exceptiontrap gem by putting this line to your `config/environment.rb` file
|
45
|
-
|
46
|
-
config.gem 'exceptiontrap'
|
47
|
-
|
48
|
-
then run `rake gems:install`
|
49
|
-
|
50
|
-
#### 2. Configure
|
51
|
-
|
52
|
-
Now generate the `config/exceptiontrap.yml` file with
|
53
|
-
|
54
|
-
script/generate exceptiontrap --api-key YOUR_API_KEY
|
55
|
-
|
56
|
-
and you should be fine.
|
57
|
-
|
58
|
-
**Note:** Some exceptions are ignored by default, e.g. `RoutingError` and `RecordNotFound` errors. You can change this behavior in the just generated `config/exceptiontrap.yml` file.
|
59
|
-
|
60
29
|
## Information / Further Configuration
|
61
30
|
|
62
31
|
You can find your API-Key by login to your [Exceptiontrap Account](https://exceptiontrap.com/login), select the application and follow the `Setup` Link.
|
data/lib/exceptiontrap.rb
CHANGED
@@ -22,21 +22,6 @@ module Exceptiontrap
|
|
22
22
|
'Accept' => 'application/json'
|
23
23
|
}
|
24
24
|
|
25
|
-
# Load for Rails 2.3 (Rack and Exceptiontrap::Catcher)
|
26
|
-
if !defined?(Rails::Railtie) && defined?(Rails.configuration) && Rails.configuration.respond_to?(:middleware)
|
27
|
-
Exceptiontrap::Config.load(File.join(Rails.root, '/config/exceptiontrap.yml'))
|
28
|
-
|
29
|
-
if enabled?
|
30
|
-
# Rails 2
|
31
|
-
if defined?(ActionController::Base) && !ActionController::Base.include?(Exceptiontrap::Catcher)
|
32
|
-
ActionController::Base.send(:include, Exceptiontrap::Catcher)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Rails >= 2.3
|
36
|
-
Rails.configuration.middleware.use 'Exceptiontrap::Rack'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
25
|
def self.notify(exception, params = {})
|
41
26
|
return if disabled?
|
42
27
|
data = Data.rack_data(exception, params)
|
@@ -6,7 +6,7 @@ module Exceptiontrap
|
|
6
6
|
class ExceptiontrapRailtie < Rails::Railtie
|
7
7
|
initializer 'exceptiontrap.middleware' do |app|
|
8
8
|
Exceptiontrap::Config.load(File.join(Rails.root, '/config/exceptiontrap.yml'))
|
9
|
-
|
9
|
+
return if Exceptiontrap::disabled?
|
10
10
|
|
11
11
|
app.config.middleware.insert_after ActionDispatch::ShowExceptions, Exceptiontrap::Rack
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exceptiontrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tbuehl
|
@@ -45,7 +45,6 @@ files:
|
|
45
45
|
- init.rb
|
46
46
|
- install.rb
|
47
47
|
- lib/exceptiontrap.rb
|
48
|
-
- lib/exceptiontrap/catcher.rb
|
49
48
|
- lib/exceptiontrap/config.rb
|
50
49
|
- lib/exceptiontrap/data.rb
|
51
50
|
- lib/exceptiontrap/notifier.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Exceptiontrap
|
2
|
-
module Catcher
|
3
|
-
def self.included(base)
|
4
|
-
# Uses the public rescue method
|
5
|
-
base.send(:alias_method, :original_rescue_action_in_public, :rescue_action_in_public)
|
6
|
-
base.send(:alias_method, :rescue_action_in_public, :rescue_action_public_exceptiontrap)
|
7
|
-
|
8
|
-
# Uses the local rescue method
|
9
|
-
base.send(:alias_method, :original_rescue_action_locally, :rescue_action)
|
10
|
-
base.send(:alias_method, :rescue_action, :rescue_action_local_exceptiontrap)
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
# When the exception occured in public
|
15
|
-
def rescue_action_public_exceptiontrap(exception)
|
16
|
-
handle_with_exceptiontrap(exception)
|
17
|
-
original_rescue_action_in_public(exception) # to rails again
|
18
|
-
end
|
19
|
-
|
20
|
-
# When the exception occured locally
|
21
|
-
def rescue_action_local_exceptiontrap(exception)
|
22
|
-
handle_with_exceptiontrap(exception)
|
23
|
-
original_rescue_action_locally(exception) # to rails again
|
24
|
-
end
|
25
|
-
|
26
|
-
# Sends the exception to exceptiontrap
|
27
|
-
def handle_with_exceptiontrap(exception)
|
28
|
-
data = Exceptiontrap::Data.rails2_data(exception, request, session, response)
|
29
|
-
Exceptiontrap::Notifier.notify(data)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|