wat_catcher 0.4.1 → 0.5.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6da448a670c6c38e4f96d5431415ef85fd8a894f
|
4
|
+
data.tar.gz: 467df91af59b680adee1ba7f8afa04009a85f84d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c4b69e9411eef64c227d81d42796357428b3b0004480f4bcd11ba3d0c1f2ed1894923ef142983604a0213e20d98f0e4a84c0af49d24f1853351ec529f94bce1
|
7
|
+
data.tar.gz: dd6a8139ab64117df7755c42257a112f72bacfa31c4fde5e00b6e26b00ea3ede8aa9fb22f7bade696856945ff71347e4f6389c0818aa318fef61483ed7e66689
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module WatCatcher
|
4
|
+
module CatcherOfWats
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
around_filter :catch_wats
|
9
|
+
end
|
10
|
+
|
11
|
+
def wat_user
|
12
|
+
current_user
|
13
|
+
end
|
14
|
+
|
15
|
+
def catch_wats(&block)
|
16
|
+
block.call
|
17
|
+
rescue Exception => e
|
18
|
+
user = nil
|
19
|
+
begin
|
20
|
+
user = wat_user
|
21
|
+
rescue;end
|
22
|
+
WatCatcher::Report.new(e, user: user, request: request)
|
23
|
+
raise
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/wat_catcher/report.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module WatCatcher
|
2
2
|
class Report
|
3
|
-
attr_accessor :exception, :request, :sidekiq
|
3
|
+
attr_accessor :exception, :request, :sidekiq, :user
|
4
4
|
|
5
|
-
def initialize(exception, request: nil, sidekiq: nil)
|
5
|
+
def initialize(exception, user: nil, request: nil, sidekiq: nil)
|
6
6
|
self.exception = exception
|
7
7
|
self.request = request
|
8
8
|
self.sidekiq = sidekiq
|
9
|
+
self.user = user
|
9
10
|
send_report
|
10
11
|
end
|
11
12
|
|
@@ -14,7 +15,12 @@ module WatCatcher
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def params
|
17
|
-
{ wat: base_description
|
18
|
+
{ wat: base_description
|
19
|
+
.merge(user_description)
|
20
|
+
.merge(exception_description)
|
21
|
+
.merge(request_description)
|
22
|
+
.merge(worker_description)
|
23
|
+
.merge(param_exception_description) }
|
18
24
|
end
|
19
25
|
|
20
26
|
def param_exception_description
|
@@ -30,6 +36,14 @@ module WatCatcher
|
|
30
36
|
}
|
31
37
|
end
|
32
38
|
|
39
|
+
def user_description
|
40
|
+
u = nil
|
41
|
+
begin
|
42
|
+
u = user.as_json
|
43
|
+
rescue; end
|
44
|
+
{ app_user: u }
|
45
|
+
end
|
46
|
+
|
33
47
|
def exception_description
|
34
48
|
return {} unless exception
|
35
49
|
{
|
data/lib/wat_catcher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wat_catcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Constantine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,11 +137,11 @@ files:
|
|
137
137
|
- LICENSE.txt
|
138
138
|
- README.md
|
139
139
|
- Rakefile
|
140
|
+
- app/controllers/concerns/wat_catcher/catcher_of_wats.rb
|
140
141
|
- app/controllers/wat_catcher/wats_controller.rb
|
141
142
|
- config/routes.rb
|
142
143
|
- lib/wat_catcher.rb
|
143
144
|
- lib/wat_catcher/engine.rb
|
144
|
-
- lib/wat_catcher/middleware.rb
|
145
145
|
- lib/wat_catcher/railtie.rb
|
146
146
|
- lib/wat_catcher/report.rb
|
147
147
|
- lib/wat_catcher/sidekiq_middleware.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module WatCatcher
|
2
|
-
class Middleware
|
3
|
-
def initialize(app)
|
4
|
-
@app = app
|
5
|
-
end
|
6
|
-
|
7
|
-
def call(env)
|
8
|
-
@app.call(env)
|
9
|
-
rescue Exception => exception
|
10
|
-
Report.new(exception, request: env["action_controller.instance"].request)
|
11
|
-
raise
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
end
|