griffin-interceptors 0.1.0 → 0.1.1

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: fbf801dc9dfaa3ffd17dec259fa7d411222276a3
4
- data.tar.gz: d46097bea89df3cc0f7acad34edc99a31861dadf
3
+ metadata.gz: 772bd86a69a96858bd66e4f81551ddcf0b9a6549
4
+ data.tar.gz: 951bacb34052702b3f89249fd29acf68dc1e5596
5
5
  SHA512:
6
- metadata.gz: 2d60a73b3e89a2581717a43fc3e9a5906a79ea6b609cf6b1e73651f6c2f6d205c10a0ffad44e42b0016430b46d0796fd03662bbe50583bc6d52ac5e7cd18a78f
7
- data.tar.gz: 9b404a3571b9f57e95654c55fc9d458046d98ddf2f0aba438cf51594a88a47c45da1ecb397d1cbdba2ca33f559784499e756090dff6c63c92699ae84ed6005cc
6
+ metadata.gz: 2e04ae6298bc7a9a7034de52381afc47a219de1fa48bc394a742b65d0fe33f147efd7e2868e1d995c958ca710ce5f74452afc8bc90c2a772f6fd6ac757a06f4e
7
+ data.tar.gz: 1af485be413670f6a7b3b77c1e68fcba6d9b8f139fa934f778057e222d03f255fcb3b9bc74140b0a613d50d866d37742540d5bfa19da5a04c7d6ea3108cc6284
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ gem 'sentry-raven'
4
+
5
+ module Griffin
6
+ module Interceptors
7
+ module Server
8
+ class RailsExceptionInterceptor < GRPC::ServerInterceptor
9
+ def request_response(*)
10
+ begin
11
+ yield
12
+ rescue ActiveRecord::RecordNotFound => e
13
+ Raven.capture_exception(e)
14
+ raise GRPC::NotFound.new(e.message)
15
+ rescue ActiveRecord::StaleObjectError => e
16
+ Raven.capture_exception(e)
17
+ raise GRPC::Aborted.new(e.message)
18
+ rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => e
19
+ Raven.capture_exception(e)
20
+ raise GRPC::FailedPrecondition.new(e.message)
21
+ end
22
+ end
23
+
24
+ alias_method :server_streamer, :request_response
25
+ alias_method :client_streamer, :request_response
26
+ alias_method :bidi_streamer, :request_response
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module Griffin
2
2
  module Interceptors
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: griffin-interceptors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuta Iwama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2018-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: griffin
@@ -107,6 +107,7 @@ files:
107
107
  - lib/griffin/interceptors/server/logging_interceptor.rb
108
108
  - lib/griffin/interceptors/server/payload_interceptor.rb
109
109
  - lib/griffin/interceptors/server/payload_streamer.rb
110
+ - lib/griffin/interceptors/server/rails_exception_interceptor.rb
110
111
  - lib/griffin/interceptors/server/raven_interceptor.rb
111
112
  - lib/griffin/interceptors/server/x_request_id_interceptor.rb
112
113
  - lib/griffin/interceptors/version.rb