Class: Griffin::Interceptors::Server::RavenInterceptor

Inherits:
GRPC::ServerInterceptor
  • Object
show all
Defined in:
lib/griffin/interceptors/server/raven_interceptor.rb

Instance Method Summary collapse

Instance Method Details

#request_response(call: nil) ⇒ Object Also known as: server_streamer, client_streamer, bidi_streamer



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/griffin/interceptors/server/raven_interceptor.rb', line 9

def request_response(call: nil, **)
  if call.['x-request-id']
    Raven.tags_context(request_id: call.['x-request-id'])
  end

  begin
    yield
  rescue => e
    raise e if e.is_a?(GRPC::BadStatus)

    GRPC.logger.error("Internal server error: #{e.message}")
    Raven.capture_exception(e)

    raise GRPC::Unknown.new('Internal server error')
  end
ensure
  Raven::Context.clear!
  Raven::BreadcrumbBuffer.clear!
end