bugsnag-ext 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/bugsnag/ext/faraday.rb +36 -0
- data/lib/bugsnag/ext/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a16278b35f044c7e90d8b7a52ad64fe50be829a8
|
4
|
+
data.tar.gz: 48eb3de4d465e30b9453eec0a66577c9800f0704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da46928a06030dc5a65d3df2bdc7623bde5a0c1549dd4bfe3207c971e5fbdbd8d3415322cf9e2e7e56ded7e2c429bdb27af16274dc29c00d41acbd2c3c0e5cf6
|
7
|
+
data.tar.gz: 4e10e9f87653166947ee7071548175527c298d124ff871a45f91c11cf0109bd52342bec9b8c7e8c06fd63ee79cfa79c97e5d3433082c464a932c15634db161c3
|
data/README.md
CHANGED
@@ -34,6 +34,17 @@ class SomeResqueJob
|
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
37
|
+
### `Bugsnag::Ext::Faraday`
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
conn = Faraday.new(url: "https://github.com/") do |faraday|
|
41
|
+
faraday.use FaradayMiddleware::Bugsnag # Need to set before :raise_error
|
42
|
+
faraday.response :raise_error
|
43
|
+
end
|
44
|
+
|
45
|
+
conn.get("/foo")
|
46
|
+
```
|
47
|
+
|
37
48
|
## Contributing
|
38
49
|
|
39
50
|
1. Fork it
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Bugsnag::Ext
|
2
|
+
# Need to inject before raise_error middleware
|
3
|
+
class Faraday < ::Faraday::Middleware
|
4
|
+
def initialize(app)
|
5
|
+
super
|
6
|
+
::Faraday::ClientError.class_eval do
|
7
|
+
include ::Bugsnag::MetaData
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
org_env = env.dup
|
13
|
+
begin
|
14
|
+
response = @app.call(env)
|
15
|
+
response
|
16
|
+
rescue ::Faraday::ClientError => e
|
17
|
+
e.bugsnag_meta_data = {
|
18
|
+
faraday: {
|
19
|
+
request: ::Bugsnag::Helpers.cleanup_obj({
|
20
|
+
url: org_env.url,
|
21
|
+
method: org_env.method,
|
22
|
+
headers: org_env.request_headers,
|
23
|
+
body: org_env.body,
|
24
|
+
}),
|
25
|
+
response: ::Bugsnag::Helpers.cleanup_obj({
|
26
|
+
status: env.status,
|
27
|
+
headers: env.response_headers,
|
28
|
+
body: env.body,
|
29
|
+
}),
|
30
|
+
}
|
31
|
+
}
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/bugsnag/ext/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Taniwaki
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- bin/setup
|
71
71
|
- bugsnag-ext.gemspec
|
72
72
|
- lib/bugsnag/ext.rb
|
73
|
+
- lib/bugsnag/ext/faraday.rb
|
73
74
|
- lib/bugsnag/ext/resque_retry.rb
|
74
75
|
- lib/bugsnag/ext/version.rb
|
75
76
|
homepage: https://github.com/dtaniwaki/bugsnag-ext
|