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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c61439aaad6fb20b8b32ca7b22b7e127d9a69d6
4
- data.tar.gz: 43865da610b79522bdc76c44e73ef44711fd7266
3
+ metadata.gz: a16278b35f044c7e90d8b7a52ad64fe50be829a8
4
+ data.tar.gz: 48eb3de4d465e30b9453eec0a66577c9800f0704
5
5
  SHA512:
6
- metadata.gz: 17329394b6571764d986971afef86154858fe5032edf11cd9bfa415f037caa5160a69e4cd7b1cd8389781efea76dd6fc579dcf621b013213bed469cb6b668287
7
- data.tar.gz: cdc1d1df0e01d970db6da797e8351f004acee36f04a18b773b832cc4066e0b22277c33cfdf8b30d3464c08e90fbb8c7264d72cc34847d234f38ae7ec6b6a2229
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
@@ -1,5 +1,5 @@
1
1
  module Bugsnag
2
2
  module Ext
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
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.1
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